<?php

include_once dirname(__DIR__).'/third_party/phpcode_shield.php';		//加载防注入代码
// header("Content-Security-Policy: upgrade-insecure-requests");
class F extends CI_Controller 
{
	/*
		构造函数
	*/
	function __construct()
	{
		header('Content-Type: text/html; charset=utf-8'); 
		parent::__construct();
		$this->load->helper('url');
	}
	
	
	/*
		判断是否微信的
	*/
	public function is_weixin()
	{ 
		if ( strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false ) {
				return true;
		}	
		return false;
	}

	public function jsonEncodeOptions($array)
	{
		$return_json = json_encode($array, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE);
		return str_replace("'","`",$return_json);
	}
	
	
	/*
		提示在微信浏览器打开
	*/
	public function warmingWX()
	{
		$data['base_url'] = base_url();				
		$this->load->view("warming_wx",$data);
	}

	/*
	* 授权地址与落地地址分开需要的函数
	*/
	public function route()
	{
		if(isset($_GET['r']) )
		{
			$r = base64_decode(urldecode($_GET['r']));
			if(strpos($r, ' ') !== false)
			{
				$route_array = explode(' ',$r);
				$code = $route_array[0];
				$dest_path   = $route_array[1];

				$this->load->model('wechat_model','',true);
				$open_info = $this->wechat_model->getInfoOpenid($code, null);
				if(is_array($open_info) && isset($open_info['openid'])){
					Header("Location:".base_url($dest_path));exit();
				}  else {
					log_message('error', __FUNCTION__.":can not get open_id in file".__FILE__." on Line ".__LINE__);
					$str = str_replace(['?','='],'/',$dest_path);
					$arr = explode('/', $str);
					if($arr[0]=='f'){
						$path = "y/all/".$arr[1];
						if(isset($arr[3])){
							$path .= "_".$arr[3];
						}
					} else if($arr[0]=='ay'){
						$path = "y/all/re_".$arr[3];
					} else if($arr[0]=='manage'){
						$path = "y/all/invite_".$arr[3];
					} else {
						show_404(__FUNCTION__.":error path");exit();
					}

					$direct_url = base_url($path."/snsapi_userinfo");
					Header("Location:".$direct_url);exit();
				}

			
			} else {
				show_404(__FUNCTION__.":no whitespace");exit();
			}
		} else {
			show_404(__FUNCTION__.":lack of params");exit();
		}
	}


	public function other()
	{
		if(isset($_GET['r']) )
		{
			$r = base64_decode(urldecode($_GET['r']));
			if(strpos($r, ' ') !== false)
			{
				$route_array = explode(' ',$r);
				$open_id = $route_array[0];
				$dest_url   = $route_array[1];
				$_SESSION['WxOpenID'] = $open_id;
				Header("Location:".$dest_url);
			} else {
				log_message('error', "function(other):r"." in file".__FILE__." on Line ".__LINE__);
				show_404();exit();
			}
		} else {
			log_message('error', "other:lack of r"." in file".__FILE__." on Line ".__LINE__);
			$this->show_404();exit();
		}
	}

	private function getAccountIdByOpenid($open_id)
	{
		$request_ary['open_id'] = $open_id;
		$this->load->model('account/account_model','',true);
		$userinfo_result = $this->account_model->getUserInfo($request_ary);
		if(!isset($userinfo_result['data']['account_id']) || $userinfo_result['data']['account_id'] == "")
		{
			return -1;
		}
		$account_id = $userinfo_result['data']['account_id'];
		return $account_id;
	}

	//大厅
	public function ym()
	{
		$baseurl = base_url();
		$arr = explode(':', $baseurl, 2);
		$base_host = substr($arr[1], 2, -1);
		if($base_host != $_SERVER['HTTP_HOST']){
            $direct_url = base_url('f/'.__FUNCTION__);

            Header("Location:".$direct_url);
            exit();
		}
		if(isset($_SESSION['WxOpenID']))
		{
			$open_id = $_SESSION['WxOpenID'];
			$request_ary['open_id'] = $open_id;
			$this->load->model('account/account_model','',true);
			$userinfo_result = $this->account_model->getUserInfo($request_ary);
			if(!isset($userinfo_result['data']['account_id']) || $userinfo_result['data']['account_id'] == "")
			{
				$direct_url = base_url("y/ym");
				Header("Location:".$direct_url);
				return;
			}
			
			$request_ary['account_id'] =$userinfo_result['data']['account_id'];
			$this->load->model('flower/room_model','',true);
			$result = $this->room_model->getRoomTicket($request_ary);
            if ($result['data']['ticket_count'] <= 0){
                $direct_url = base_url("f/gh");
                Header("Location:".$direct_url);
            }
			$session_request['dealer_num'] = 2;
			$session_request['account_id'] = $userinfo_result['data']['account_id'];
			$session_request['type'] = '';
			$this->load->model('verification_model','',true);
			$sessionResult = $this->verification_model->createRequestSession($session_request);
			$data['session'] = $sessionResult;

			$this->load->model('wechat_model','',true);
			$config_ary = $this->wechat_model->getWxConfig();
			$data['config_ary']=$config_ary;

			$data['base_url'] = base_url();

            $data['socket55'] = Game_Const::WebSocket_Bull;
            $data['socket59'] = Game_Const::WebSocket_Bull9;
            $data['socket52'] = Game_Const::WebSocket_Bull12;
            $data['socket56'] = Game_Const::WebSocket_Bull6B;
            $data['socket58'] = Game_Const::WebSocket_Bull8B;
            $data['socket53'] = Game_Const::WebSocket_LaiBull;

            $data['socket30'] = Game_Const::WebSocket_Zjh12;
            $data['socket25'] = Game_Const::WebSocket_Xpjh;
            $data['socket24'] = Game_Const::WebSocket_MpZjh;
            $data['socket29'] = Game_Const::WebSocket_Zjh9;
            $data['socket26'] = Game_Const::WebSocket_Host;

			$data['socket2'] = Game_Const::WebSocket_Landlord;
			$data['socket4'] = Game_Const::WebSocket_Gdmj;
            $data['socket7'] = Game_Const::WebSocket_SG;
            $data['socket8'] = Game_Const::WebSocket_EBA;


			$data['socket12'] = Game_Const::WebSocket_PaiJiu;
			$data['socket14'] = Game_Const::WebSocket_Dcx;
			$data['socket15'] = Game_Const::WebSocket_Yxx;
			$data['socket16'] = Game_Const::WebSocket_SG9;

				
			$data['user'] = $userinfo_result['data'];
			$data['card'] = $result['data']['ticket_count'];
			$data['account_id'] = $userinfo_result['data']['account_id'];
			$data['room_url'] = base_url("y/ym");

			$data['file_url'] = $data['base_url']; 
			$data['image_url']= Game_Const::ImageUrl; 
			$data['http_url'] = "https://connwss.fairyland.xin/";
			$data['dealer_num'] = 2;
			$data['isAuthPhone'] = 0;
			$data['authCardCount'] = 10;
			$data['phone'] = '';
			$data['open_id'] = '';
            $data['clientName'] = Game_CONST::Client_Name;
            $data['clientType'] = Game_CONST::Client_Type;
			//广播
			$data['is_announcement']=0;
			$data['announcement_content']='';
			$data['announcement_sec']='0';
			$this->load->model('message/message_model','',true);
			$result = $this->message_model->getGameMessageInfo();
			if ($result['result'] == 0) {
				$data['is_announcement'] = $result['data']['announcement_dict']['is_show'];
				$data['announcement_sec'] = $result['data']['announcement_dict']['total_sec'];
				$aContent = '';
				$arrayContent = $result['data']['announcement_dict']['content_ary'];
				foreach ($arrayContent as $value) {
					$aContent = $aContent.$value;
				}
				$data['announcement_content'] = $aContent;
			}
			//广播end

			$this->load->view("home.php",$data);	
		}
		else
		{
			$direct_url = base_url("y/ym");
			Header("Location:".$direct_url);
		}
	}
    public function dk(){
        $baseurl = base_url();
        $arr = explode(':', $baseurl, 2);
        $base_host = substr($arr[1], 2, -1);
        if($base_host != $_SERVER['HTTP_HOST']){
            $direct_url = base_url('f/'.__FUNCTION__);

            Header("Location:".$direct_url);
            exit();
        }

        $data['socket55'] = Game_Const::WebSocket_Bull;
        $data['socket59'] = Game_Const::WebSocket_Bull9;
        $data['socket52'] = Game_Const::WebSocket_Bull12;
        $data['socket56'] = Game_Const::WebSocket_Bull6B;
        $data['socket58'] = Game_Const::WebSocket_Bull8B;
        $data['socket53'] = Game_Const::WebSocket_LaiBull;

        $data['socket30'] = Game_Const::WebSocket_Zjh12;
        $data['socket25'] = Game_Const::WebSocket_Xpjh;
        $data['socket24'] = Game_Const::WebSocket_MpZjh;
        $data['socket29'] = Game_Const::WebSocket_Zjh9;
        $data['socket26'] = Game_Const::WebSocket_Host;

        $data['socket2'] = Game_Const::WebSocket_Landlord;
        $data['socket4'] = Game_Const::WebSocket_Gdmj;
        $data['socket7'] = Game_Const::WebSocket_SG;
        $data['socket8'] = Game_Const::WebSocket_EBA;


        $data['socket12'] = Game_Const::WebSocket_PaiJiu;
        $data['socket14'] = Game_Const::WebSocket_Dcx;
        $data['socket15'] = Game_Const::WebSocket_Yxx;
        $data['socket16'] = Game_Const::WebSocket_SG9;

        if(isset($_SESSION['WxOpenID'])){
            $open_id = $_SESSION['WxOpenID'];
            $request_ary['open_id'] = $open_id;
            $this->load->model('account/account_model','',true);
            $userinfo_result = $this->account_model->getUserInfo($request_ary);
            if(!isset($userinfo_result['data']['account_id']) || $userinfo_result['data']['account_id'] == "")
            {
                $direct_url = base_url("y/ym");
                Header("Location:".$direct_url);
                return;
            }


            $session_request['dealer_num'] = 2;
            $session_request['account_id'] = $userinfo_result['data']['account_id'];
            $session_request['type'] = '';
            $this->load->model('verification_model','',true);
            $sessionResult = $this->verification_model->createRequestSession($session_request);
            $data['session'] = $sessionResult;

            $this->load->model('wechat_model','',true);
            $config_ary = $this->wechat_model->getWxConfig();
            $data['config_ary']=$config_ary;

            $data['base_url'] = base_url();

            $data['user'] = $userinfo_result['data'];

            $data['account_id'] = $userinfo_result['data']['account_id'];
            $data['room_url'] = base_url("y/ym");

            $data['file_url'] = $data['base_url'];
            $data['image_url']= Game_Const::ImageUrl;
            $data['dealer_num'] = 2;
            $data['isAuthPhone'] = 0;
            $data['authCardCount'] = 10;
            $data['phone'] = '';
            $data['open_id'] = '';

            $this->load->model("manage/manage_model",'',true);


            if ( isset($_GET['manage_id'])) {
                $manage_id =$_GET['manage_id'];
                $manage = $this->manage_model->getManageInfo($userinfo_result['data']['account_id'] ,$manage_id);
                $managerInfo = $this->account_model->getUserByAccountID($manage_id);

                if ($managerInfo['result'] == OPT_CONST::FAILED || $managerInfo['data']['is_manage_on'] == 0){
                    $direct_url = base_url("f/gh?manage_id=" . $manage_id);
                    Header("Location:".$direct_url);
                }
                if ($manage['result'] == OPT_CONST::FAILED|| $manage['data']['is_admin'] == 0){
                    $direct_url = base_url("f/gh?manage_id=" . $manage_id);
                    Header("Location:".$direct_url);
                }

                $tcn['url_now'] = base_url() . "f/gh?manage_id=" . $manage_id;
                $tcn['url_long'] = $this->config->item("short_url").$tcn['url_now'];
                $data['manager_url'] = $this->account_model->convertUrl($tcn);

                $data['manager_info'] = $managerInfo['data'];


                $request_ary['account_id'] =$manage_id;
                $this->load->model('flower/room_model','',true);
                $result = $this->room_model->getRoomTicket($request_ary);
                $data['card'] = $result['data']['ticket_count'];

                $manageList = $this->manage_model->getManageList( $data['user']['account_id']);
                if ( $manageList['result'] == OPT_CONST::SUCCESS){
                    $data['manageList'] = $manageList['data'];
                    if (!empty($manageList['data'])) {
                        foreach ($manageList['data'] as $item) {
                            if ($item['manager_id']==$manage_id){
                                $data['manager_item'] = $item;
                            }
                        }
                    }
                }


                $data['manager_info']['card'] =$result['data']['ticket_count'];
            }else{
                $data['manager_url'] = null;
                $data['manager_info'] = null;
                $data['manager_item'] = null;
            }

            $this->load->view("daikai.php",$data);
        }else {
            $direct_url = base_url("y/ym");
            Header("Location:".$direct_url);
        }

    }

	public function gh(){
        $baseurl = base_url();
        $arr = explode(':', $baseurl, 2);
        $base_host = substr($arr[1], 2, -1);
        if($base_host != $_SERVER['HTTP_HOST']){
            $direct_url = base_url('f/'.__FUNCTION__);

            Header("Location:".$direct_url);
            exit();
        }
        if(isset($_SESSION['WxOpenID'])){
            $open_id = $_SESSION['WxOpenID'];
            $request_ary['open_id'] = $open_id;
            $this->load->model('account/account_model','',true);
            $userinfo_result = $this->account_model->getUserInfo($request_ary);
            if(!isset($userinfo_result['data']['account_id']) || $userinfo_result['data']['account_id'] == "")
            {
                $direct_url = base_url("y/ym");
                Header("Location:".$direct_url);
                return;
            }

            $request_ary['account_id'] =$userinfo_result['data']['account_id'];
            $this->load->model('flower/room_model','',true);
            $result = $this->room_model->getRoomTicket($request_ary);

            $session_request['dealer_num'] = 2;
            $session_request['account_id'] = $userinfo_result['data']['account_id'];
            $session_request['type'] = '';
            $this->load->model('verification_model','',true);
            $sessionResult = $this->verification_model->createRequestSession($session_request);
            $data['session'] = $sessionResult;

            $this->load->model('wechat_model','',true);
            $config_ary = $this->wechat_model->getWxConfig();
            $data['config_ary']=$config_ary;

            $data['base_url'] = base_url();

            $data['user'] = $userinfo_result['data'];
            $data['card'] = $result['data']['ticket_count'];
            $data['account_id'] = $userinfo_result['data']['account_id'];
            $data['room_url'] = base_url("y/ym");

            $data['file_url'] = $data['base_url'];
            $data['image_url']= Game_Const::ImageUrl;
            $data['dealer_num'] = 2;
            $data['isAuthPhone'] = 0;
            $data['authCardCount'] = 10;
            $data['phone'] = '';
            $data['open_id'] = '';

            $this->load->model("manage/manage_model",'',true);
            $manageList = $this->manage_model->getManageList( $data['user']['account_id']);
            $manage_id = false;
            if ( $manageList['result'] == OPT_CONST::SUCCESS){
                $data['manageList'] = $manageList['data'];
                if (isset($_GET['manage_id'])){
                    $manage_id = $_GET['manage_id'];
                }else {
                    $manage_id = $manageList['data'][0]['manager_id'];
                }
                $this->load->model('flower/room_model','',true);
                $roomList = $this->room_model->getRoomList(["manage_id" => $manage_id]);
                $data['roomList'] = $roomList['data'];

                $d = array();
                if (!empty($manageList['data'])) {
                    foreach ($manageList['data'] as $item) {
                        if ($item['manager_id']==$manage_id){
                            $data['manager_item'] = $item;
                        }
                    }
                }

            }
            if ($manage_id) {
                $tcn['url_now'] = base_url() . "f/gh?manage_id=" . $manage_id;
                $tcn['url_long'] = $this->config->item("short_url").$tcn['url_now'];
                $data['manager_url'] = $this->account_model->convertUrl($tcn);
                $res = $this->account_model->getUserByAccountID($manage_id);
                $data['manager_info'] = $res['data'];

                $manage = $this->manage_model->getManageInfo($userinfo_result['data']['account_id'] ,$manage_id);
                $data['manage'] = $manage['data'];
            }else{
                $data['manager_url'] = false;
                $data['manager_info'] = false;
                $data['manager_item'] = false;
            }

            $this->load->view("gongHui.php",$data);
        }else {
            $direct_url = base_url("y/ym");
            Header("Location:".$direct_url);
        }

    }
    public function ss(){
        $baseurl = base_url();
        $arr = explode(':', $baseurl, 2);
        $base_host = substr($arr[1], 2, -1);
        if($base_host != $_SERVER['HTTP_HOST']){
            $direct_url = base_url('f/'.__FUNCTION__);
            Header("Location:".$direct_url);
            exit();
        }
        if(isset($_SESSION['WxOpenID'])){
            $open_id = $_SESSION['WxOpenID'];
            $request_ary['open_id'] = $open_id;
            $this->load->model('account/account_model','',true);
            $userinfo_result = $this->account_model->getUserInfo($request_ary);
            if(!isset($userinfo_result['data']['account_id']) || $userinfo_result['data']['account_id'] == "")
            {
                $direct_url = base_url("y/ym");
                Header("Location:".$direct_url);
                return;
            }

            $request_ary['account_id'] =$userinfo_result['data']['account_id'];
            $this->load->model('flower/room_model','',true);
            $result = $this->room_model->getRoomTicket($request_ary);

            $session_request['dealer_num'] = 2;
            $session_request['account_id'] = $userinfo_result['data']['account_id'];
            $session_request['type'] = '';
            $this->load->model('verification_model','',true);
            $sessionResult = $this->verification_model->createRequestSession($session_request);
            $data['session'] = $sessionResult;

            $this->load->model('wechat_model','',true);
            $config_ary = $this->wechat_model->getWxConfig();
            $data['config_ary']=$config_ary;

            $data['base_url'] = base_url();

            $data['user'] = $userinfo_result['data'];
            $data['card'] = $result['data']['ticket_count'];
            $data['account_id'] = $userinfo_result['data']['account_id'];
            $data['room_url'] = base_url("y/ym");

            $data['file_url'] = $data['base_url'];
            $data['image_url']= Game_Const::ImageUrl;
            $data['dealer_num'] = 2;
            $data['isAuthPhone'] = 0;
            $data['authCardCount'] = 10;
            $data['phone'] = '';
            $data['open_id'] = '';

//            $this->load->model("manage/manage_model",'',true);
//            $manageList = $this->manage_model->getManageList( $data['user']['account_id']);

//            if ( $manageList['result'] == OPT_CONST::SUCCESS){
//                $data['manageList'] = $manageList['data'];
//                if (isset($_GET['manage_id'])){
//                    $manage_id = $_GET['manage_id'];
//                }else {
//                    $manage_id = $manageList['data'][0]['manager_id'];
//                }
//                $arrData['manage_id'] = $manage_id;
//                if ($manage_id != $userinfo_result['data']['account_id']){
//                    $arrData['account_id'] = $userinfo_result['data']['account_id'];
//                }elseif(isset($_GET['account_id'])){
//                    $arrData['account_id'] = $_GET['account_id'];
//                }
                $this->load->model('flower/room_model','',true);
                $searchArr["start_time"] = isset($_GET["start_time"])? $_GET["start_time"] : date("Y-m-d H:i", strtotime("-1 Days"));
                $searchArr["end_time"] = isset($_GET["end_time"])? $_GET["end_time"] : date("Y-m-d H:i");
                if (isset($_GET['game_type']) && !empty($_GET['game_type'])){
                    $searchArr["game_type"] = $_GET['game_type'];
                }
                if ( strtotime($searchArr['end_time']) - strtotime($searchArr['start_time'])  > 2*24*60*60){
                    $searchArr['end_time'] = date("Y-m-d H:i", strtotime($searchArr['start_time']) + 2*24*60*60);
                }
            $searchArr['manage_id'] = $data['account_id'];
                $scoreList = $this->room_model->getManagerRoomScoreList($searchArr);
                $accountList = [];
                if ($scoreList['result'] == OPT_CONST::SUCCESS) {
                    foreach ($scoreList['data'] as &$item) {
                        $accountIdList[] = $item['account_id'];
                        $accountInfo = $this->account_model->getUserByAccountID($item['account_id']);
                        $item['nickname'] = $accountInfo['data']['nickname'];
                        $item['headimgurl'] = $accountInfo['data']['headimgurl'];
                        $accountList[$item['account_id']] = $accountInfo;
                        $item['create_time'] = date("m-d H:i",$item['create_time']);
                    }
                }
                $data['searchArr'] = $searchArr;
                $data['accountList'] = $accountList;
                $data['scoreList'] = $scoreList['data'];
//            }

            $this->load->view("scoreSearch.php",$data);
        }else {
            $direct_url = base_url("y/ym");
            Header("Location:".$direct_url);
        }
    }


    //血拼炸金花
	public function xpjh()
	{
		if (isset($_SESSION['WxOpenID'])&&isset($_GET['i'])) {
			$open_id = $_SESSION['WxOpenID'];

			$state = $_GET['i'];
			$user_code = "";
			if(strpos($state, "_") !== false)
			{
				$state_array = explode("_",$state);
				$room_number = $state_array[0];
				$user_code   = $state_array[1];
			} else {
				log_message('error', "function(xpjh):state"." in file".__FILE__." on Line ".__LINE__);
				show_404();exit;
			}
			$request_ary['open_id'] = $open_id;
			$request_ary['user_code'] = $user_code;
			$this->load->model('account/account_model','',true);
			$userinfo_result = $this->account_model->getUserInfo($request_ary);
			if(!isset($userinfo_result['data']['account_id']) || $userinfo_result['data']['account_id'] == "")
			{
				log_message('error', "function(xpjh):state"." in file".__FILE__." on Line ".__LINE__);
				show_404();exit;
			}

			$request_ary['account_id'] = $userinfo_result['data']['account_id'];
			$this->load->model('flower/room_model','',true);
			$result = $this->room_model->getRoomTicket($request_ary);

			$session_request['dealer_num'] = 2;
			$session_request['account_id'] = $userinfo_result['data']['account_id'];
			$session_request['type'] = '';
			$this->load->model('verification_model','',true);
			$sessionResult = $this->verification_model->createRequestSession($session_request);
			$data['session'] = $sessionResult;

			//获取关闭房间积分榜
			$request_ary['game_type'] = 25;
			$request_ary['room_number'] = $room_number;
			$score_result = $this->room_model->getRoomScoreboard($request_ary);
			if(isset($score_result['data']['room_status']) && isset($score_result['data']['balance_scoreboard']))
			{
				$data['room_status'] = $score_result['data']['room_status'];
				$data['balance_scoreboard'] = $this->jsonEncodeOptions($score_result['data']['balance_scoreboard']);
			}
			else
			{
				$data['room_status'] = -1;
				$data['balance_scoreboard'] = "";
			}

			$this->load->model('wechat_model','',true);
			$config_ary = $this->wechat_model->getWxConfig();
			$data['config_ary']=$config_ary;

			$data['user'] = $userinfo_result['data'];
			$data['socket'] = Game_Const::WebSocket_Xpjh;
			$data['base_url'] = base_url();
			$data['card'] = $result['data']['ticket_count'];
			$data['room_number'] = $room_number;
//			$data['room_url'] = $data['base_url']."f/xpjh?i=".$room_number."_".$userinfo_result['data']['user_code'];
            //增加短码地址生成
            $tcn['url_now'] = $data['base_url']."f/xpjh?i=".$room_number."_".$userinfo_result['data']['user_code'];
            $tcn['url_long'] = $this->config->item("short_url").$tcn['url_now'];
            $data['room_url'] = $this->account_model->convertUrl($tcn);

            $data['file_url'] = Game_Const::FileUrl;
			$data['image_url']= Game_Const::ImageUrl; 

			$data['dealer_num'] = 2;
			$data['open_id'] = '';
			$data['isAuthPhone'] = 0;
			$data['authCardCount'] = 10;
			$data['phone'] = '';
			//广播
			$data['is_announcement']=0;
			$data['announcement_content']='';
			$data['announcement_sec']='0';
			$this->load->model('message/message_model','',true);
			$result = $this->message_model->getGameMessageInfo();
			if ($result['result'] == 0) {
				$data['is_announcement'] = $result['data']['announcement_dict']['is_show'];
				$data['announcement_sec'] = $result['data']['announcement_dict']['total_sec'];
				$aContent = '';
				$arrayContent = $result['data']['announcement_dict']['content_ary'];
				foreach ($arrayContent as $value) {
					$aContent = $aContent.$value;
				}
				$data['announcement_content'] = $aContent;
			}
			// end 广播
			
			$data['game_type']=$request_ary['game_type'];	//页面传入game type

			$this->load->view("nflower-xp.php",$data);	
		}   else if(isset($_GET['i'])) {			
			$direct_url = base_url("y/xpjh/".$_GET['i']);
			Header("Location:".$direct_url);
		} 
	}



    //明牌炸金花
	public function mpZjh()
	{
		if (isset($_SESSION['WxOpenID'])&&isset($_GET['i'])) {
			$open_id = $_SESSION['WxOpenID'];

			$state = $_GET['i'];
			$user_code = "";
			if(strpos($state, "_") !== false)
			{
				$state_array = explode("_",$state);
				$room_number = $state_array[0];
				$user_code   = $state_array[1];
			} else {
				log_message('error', "function(mpZjh):state"." in file".__FILE__." on Line ".__LINE__);
				show_404();exit;
			}
			$request_ary['open_id'] = $open_id;
			$request_ary['user_code'] = $user_code;
			$this->load->model('account/account_model','',true);
			$userinfo_result = $this->account_model->getUserInfo($request_ary);
			if(!isset($userinfo_result['data']['account_id']) || $userinfo_result['data']['account_id'] == "")
			{
				log_message('error', "function(mpZjh):state"." in file".__FILE__." on Line ".__LINE__);
				show_404();exit;
			}

			$request_ary['account_id'] = $userinfo_result['data']['account_id'];
			$this->load->model('flower/room_model','',true);
			$result = $this->room_model->getRoomTicket($request_ary);

			$session_request['dealer_num'] = 2;
			$session_request['account_id'] = $userinfo_result['data']['account_id'];
			$session_request['type'] = '';
			$this->load->model('verification_model','',true);
			$sessionResult = $this->verification_model->createRequestSession($session_request);
			$data['session'] = $sessionResult;

			//获取关闭房间积分榜
			$request_ary['game_type'] = 24;
			$request_ary['room_number'] = $room_number;
			$score_result = $this->room_model->getRoomScoreboard($request_ary);
			if(isset($score_result['data']['room_status']) && isset($score_result['data']['balance_scoreboard']))
			{
				$data['room_status'] = $score_result['data']['room_status'];
				$data['balance_scoreboard'] = $this->jsonEncodeOptions($score_result['data']['balance_scoreboard']);
			}
			else
			{
				$data['room_status'] = -1;
				$data['balance_scoreboard'] = "";
			}

			$this->load->model('wechat_model','',true);
			$config_ary = $this->wechat_model->getWxConfig();
			$data['config_ary']=$config_ary;

			$data['user'] = $userinfo_result['data'];
			$data['socket'] = Game_Const::WebSocket_MpZjh;
			$data['base_url'] = base_url();
			$data['card'] = $result['data']['ticket_count'];
			$data['room_number'] = $room_number;
//			$data['room_url'] = $data['base_url']."f/mpZjh?i=".$room_number."_".$userinfo_result['data']['user_code'];
            //增加短码地址生成
            $tcn['url_now'] = $data['base_url']."f/mpZjh?i=".$room_number."_".$userinfo_result['data']['user_code'];
            $tcn['url_long'] = $this->config->item("short_url").$tcn['url_now'];
            $data['room_url'] = $this->account_model->convertUrl($tcn);

            $data['file_url'] = Game_Const::ImageUrl;
			$data['image_url']= Game_Const::ImageUrl; 

			$data['dealer_num'] = 2;
			$data['open_id'] = '';
			$data['isAuthPhone'] = 0;
			$data['authCardCount'] = 10;
			$data['phone'] = '';
			//广播
			$data['is_announcement']=0;
			$data['announcement_content']='';
			$data['announcement_sec']='0';
			$this->load->model('message/message_model','',true);
			$result = $this->message_model->getGameMessageInfo();
			if ($result['result'] == 0) {
				$data['is_announcement'] = $result['data']['announcement_dict']['is_show'];
				$data['announcement_sec'] = $result['data']['announcement_dict']['total_sec'];
				$aContent = '';
				$arrayContent = $result['data']['announcement_dict']['content_ary'];
				foreach ($arrayContent as $value) {
					$aContent = $aContent.$value;
				}
				$data['announcement_content'] = $aContent;
			}
			// end 广播
			$this->load->view("mpZjh.php",$data);	
		}   else if(isset($_GET['i'])) {			
			$direct_url = base_url("y/mpZjh/".$_GET['i']);
			Header("Location:".$direct_url);
		} 
	}


	/**
	* 赖子牛牛
	*/
	public function laib() {
		if (isset($_SESSION['WxOpenID'])&&isset($_GET['i'])) {
			$open_id = $_SESSION['WxOpenID'];

			$state = $_GET['i'];
			if(strpos($state, "_") !== false)
			{
					$state_array = explode("_",$state);
					$room_number = $state_array[0];
					$user_code   = $state_array[1];
			} else {
					log_message('error', "function(laib):state"." in file".__FILE__." on Line ".__LINE__);
					show_404();exit;
			}

			$request_ary['open_id'] = $open_id;
			$request_ary['user_code'] = $user_code;
			$this->load->model('account/account_model','',true);
			$userinfo_result = $this->account_model->getUserInfo($request_ary);
			if(!isset($userinfo_result['data']['account_id']) || $userinfo_result['data']['account_id'] == "")
			{

					$direct_url = base_url("y/laib/".$_GET['i']);
					Header("Location:".$direct_url);
					return;
			}
			$request_ary['account_id'] = $userinfo_result['data']['account_id'];
			$this->load->model('flower/room_model','',true);
			$result = $this->room_model->getRoomTicket($request_ary);

			$session_request['dealer_num'] = 2;
			$session_request['account_id'] = $userinfo_result['data']['account_id'];
			$session_request['type'] = '';
			$this->load->model('verification_model','',true);
			$sessionResult = $this->verification_model->createRequestSession($session_request);
			$data['session'] = $sessionResult;

			//获取关闭房间积分榜
			$request_ary['game_type'] = 53;
			$request_ary['room_number'] = $room_number;
			$score_result = $this->room_model->getRoomScoreboard($request_ary);
			if(isset($score_result['data']['room_status']) && isset($score_result['data']['balance_scoreboard']))
			{
					$data['room_status'] = $score_result['data']['room_status'];
					$data['balance_scoreboard'] = $this->jsonEncodeOptions($score_result['data']['balance_scoreboard']);
			}
			else
			{
					$data['room_status'] = -1;
					$data['balance_scoreboard'] = "";
			}

			$this->load->model('wechat_model','',true);
			$config_ary = $this->wechat_model->getWxConfig();
			$data['config_ary']=$config_ary;

			$data['user'] = $userinfo_result['data'];
			$data['socket'] = Game_Const::WebSocket_LaiBull;
			$data['base_url'] = base_url();
			$data['card'] = $result['data']['ticket_count'];
			$data['room_number'] = $room_number;
//			$data['room_url'] = $data['base_url']."f/laib?i=".$room_number."_".$userinfo_result['data']['user_code'];
            //增加短码地址生成
            $tcn['url_now'] = $data['base_url']."f/laib?i=".$room_number."_".$userinfo_result['data']['user_code'];
            $tcn['url_long'] = $this->config->item("short_url").$tcn['url_now'];
            $data['room_url'] = $this->account_model->convertUrl($tcn);

            $data['file_url'] = Game_Const::ImageUrl;
			$data['image_url']= Game_Const::ImageUrl;
			

			$data['game_type'] = $request_ary['game_type'];
			$data['dealer_num'] = 2;
			$data['open_id'] = '';
			$data['isAuthPhone'] = 0;
			$data['authCardCount'] = 10;
			$data['phone'] = '';

			//广播
			$data['is_announcement']=0;
			$data['announcement_content']='';
			$data['announcement_sec']='0';
			$this->load->model('message/message_model','',true);
			$result = $this->message_model->getGameMessageInfo();
			if ($result['result'] == 0) {
					$data['is_announcement'] = $result['data']['announcement_dict']['is_show'];
					$data['announcement_sec'] = $result['data']['announcement_dict']['total_sec'];
					$aContent = '';
					$arrayContent = $result['data']['announcement_dict']['content_ary'];
					foreach ($arrayContent as $value) {
							$aContent = $aContent.$value;
					}
					$data['announcement_content'] = $aContent;
			}
			// end 广播

			$data['max_times'] = $score_result['data']['max_times'];
            if($score_result['data']['max_count'] == 6){
                $this->load->view("laibull6.php",$data);
            } elseif($score_result['data']['max_count'] == 9){
					$this->load->view("laibull9.php",$data);
			} else {
					$this->load->view("laibull12.php",$data);
			}
		}   else if(isset($_GET['i'])) {
				$direct_url = base_url("y/laib/".$_GET['i']);
				Header("Location:".$direct_url);
		}
	}


    /**
     * 9人三公房间入口
     */
    public function sg9() {
        if (isset($_SESSION['WxOpenID'])&&isset($_GET['i'])) {
            $open_id = $_SESSION['WxOpenID'];

            $state = $_GET['i'];
            if(strpos($state, "_") !== false)
            {
                $state_array = explode("_",$state);
                $room_number = $state_array[0];
                $user_code   = $state_array[1];
            } else {
                log_message('error', "function(sg9):state"." in file".__FILE__." on Line ".__LINE__);
                show_404();exit;
            }

            $request_ary['open_id'] = $open_id;
            $request_ary['user_code'] = $user_code;
            $this->load->model('account/account_model','',true);
            $userinfo_result = $this->account_model->getUserInfo($request_ary);
            if(!isset($userinfo_result['data']['account_id']) || $userinfo_result['data']['account_id'] == "")
            {

                $direct_url = base_url("y/sg9/".$_GET['i']);
                Header("Location:".$direct_url);
                return;
                //log_message('error', "function(nb):state"." in file".__FILE__." on Line ".__LINE__);
                //show_404();exit;
            }

            $request_ary['account_id'] = $userinfo_result['data']['account_id'];
            $this->load->model('flower/room_model','',true);
            $result = $this->room_model->getRoomTicket($request_ary);

            $session_request['dealer_num'] = 2;
            $session_request['account_id'] = $userinfo_result['data']['account_id'];
            $session_request['type'] = '';
            $this->load->model('verification_model','',true);
            $sessionResult = $this->verification_model->createRequestSession($session_request);
            $data['session'] = $sessionResult;

            //获取关闭房间积分榜
            $request_ary['game_type'] = 22;
            $request_ary['room_number'] = $room_number;
            $score_result = $this->room_model->getRoomScoreboard($request_ary);
            if(isset($score_result['data']['room_status']) && isset($score_result['data']['balance_scoreboard']))
            {
                $data['room_status'] = $score_result['data']['room_status'];
                $data['balance_scoreboard'] = $this->jsonEncodeOptions($score_result['data']['balance_scoreboard']);
            }
            else
            {
                $data['room_status'] = -1;
                $data['balance_scoreboard'] = "";
            }

            $this->load->model('wechat_model','',true);
            $config_ary = $this->wechat_model->getWxConfig();
            $data['config_ary']=$config_ary;

			$data['user'] = $userinfo_result['data'];
			$data['game_type'] = $request_ary['game_type'];
            $data['socket'] = Game_Const::WebSocket_SG9;
            $data['base_url'] = base_url();
            $data['card'] = $result['data']['ticket_count'];
            $data['room_number'] = $room_number;
//            $data['room_url'] = $data['base_url']."f/sg9?i=".$room_number."_".$userinfo_result['data']['user_code'];
            //增加短码地址生成
            $tcn['url_now'] = $data['base_url']."f/sg9?i=".$room_number."_".$userinfo_result['data']['user_code'];
            $tcn['url_long'] = $this->config->item("short_url").$tcn['url_now'];
            $data['room_url'] = $this->account_model->convertUrl($tcn);
            $data['file_url'] = Game_Const::ImageUrl;
            $data['image_url']= Game_Const::ImageUrl;
            $data['http_url'] = "https://connwss.fairyland.xin/";

            $data['dealer_num'] = 2;
            $data['open_id'] = '';
            $data['isAuthPhone'] = 0;
            $data['authCardCount'] = 10;
            $data['phone'] = '';


            //公告
            $data['is_announcement']=0;
            $data['announcement_content']='';
            $data['announcement_sec']='0';

            $this->load->model('message/message_model','',true);
            $result = $this->message_model->getGameMessageInfo();

            if ($result['result'] == 0) {
                $data['is_announcement'] = $result['data']['announcement_dict']['is_show'];
                $data['announcement_sec'] = $result['data']['announcement_dict']['total_sec'];

                $aContent = '';
                $arrayContent = $result['data']['announcement_dict']['content_ary'];
                foreach ($arrayContent as $value) {
                    $aContent = $aContent.$value;
                }

                $data['announcement_content'] = $aContent;
            }

            $this->load->view("sg/sg9.php",$data);
        }   else if(isset($_GET['i'])) {
            $direct_url = base_url("y/sg9/".$_GET['i']);
            Header("Location:".$direct_url);
        }
    }

	/**
	* 鱼虾蟹
	*/
	public function yxx() {
		if (isset($_SESSION['WxOpenID'])&&isset($_GET['i'])) {
			$open_id = $_SESSION['WxOpenID'];

			$state = $_GET['i'];
			if(strpos($state, "_") !== false)
			{
					$state_array = explode("_",$state);
					$room_number = $state_array[0];
					$user_code   = $state_array[1];
			} else {
					log_message('error', "function(yxx):state"." in file".__FILE__." on Line ".__LINE__);
					show_404();exit;
			}

			$request_ary['open_id'] = $open_id;
			$request_ary['user_code'] = $user_code;
			$this->load->model('account/account_model','',true);
			$userinfo_result = $this->account_model->getUserInfo($request_ary);
			if(!isset($userinfo_result['data']['account_id']) || $userinfo_result['data']['account_id'] == "")
			{

					$direct_url = base_url("y/yxx/".$_GET['i']);
					Header("Location:".$direct_url);
					return;
			}
			$request_ary['account_id'] = $userinfo_result['data']['account_id'];
			$this->load->model('flower/room_model','',true);
			$result = $this->room_model->getRoomTicket($request_ary);

			$session_request['dealer_num'] = 2;
			$session_request['account_id'] = $userinfo_result['data']['account_id'];
			$session_request['type'] = '';
			$this->load->model('verification_model','',true);
			$sessionResult = $this->verification_model->createRequestSession($session_request);
			$data['session'] = $sessionResult;

			//获取关闭房间积分榜
			$request_ary['game_type'] = 21;
			$request_ary['room_number'] = $room_number;
			$score_result = $this->room_model->getRoomScoreboard($request_ary);
			if(isset($score_result['data']['room_status']) && isset($score_result['data']['balance_scoreboard']))
			{
					$data['room_status'] = $score_result['data']['room_status'];
					$data['balance_scoreboard'] = $this->jsonEncodeOptions($score_result['data']['balance_scoreboard']);
			}
			else
			{
					$data['room_status'] = -1;
					$data['balance_scoreboard'] = "";
			}

			$this->load->model('wechat_model','',true);
			$config_ary = $this->wechat_model->getWxConfig();
			$data['config_ary']=$config_ary;

			$data['user'] = $userinfo_result['data'];
			$data['socket'] = Game_Const::WebSocket_Yxx;
			$data['base_url'] = base_url();
			$data['card'] = $result['data']['ticket_count'];
			$data['room_number'] = $room_number;
//			$data['room_url'] = $data['base_url']."f/yxx?i=".$room_number."_".$userinfo_result['data']['user_code'];
            //增加短码地址生成
            $tcn['url_now'] = $data['base_url']."f/yxx?i=".$room_number."_".$userinfo_result['data']['user_code'];
            $tcn['url_long'] = $this->config->item("short_url").$tcn['url_now'];
            $data['room_url'] = $this->account_model->convertUrl($tcn);
			$data['file_url'] = Game_Const::ImageUrl;
			$data['image_url']= Game_Const::ImageUrl;
			$data['http_url'] = "https://connwss.fairyland.xin/";

			$data['game_type'] = $request_ary['game_type'];
			$data['dealer_num'] = 2;
			$data['open_id'] = '';
			$data['isAuthPhone'] = 0;
			$data['authCardCount'] = 10;
			$data['phone'] = '';

			//广播
			$data['is_announcement']=0;
			$data['announcement_content']='';
			$data['announcement_sec']='0';
			$this->load->model('message/message_model','',true);
			$result = $this->message_model->getGameMessageInfo();
			if ($result['result'] == 0) {
					$data['is_announcement'] = $result['data']['announcement_dict']['is_show'];
					$data['announcement_sec'] = $result['data']['announcement_dict']['total_sec'];
					$aContent = '';
					$arrayContent = $result['data']['announcement_dict']['content_ary'];
					foreach ($arrayContent as $value) {
							$aContent = $aContent.$value;
					}
					$data['announcement_content'] = $aContent;
			}
			// end 广播
			$this->load->view("yxx.php",$data);
		}   else if(isset($_GET['i'])) {
				$direct_url = base_url("y/yxx/".$_GET['i']);
				Header("Location:".$direct_url);
		}
	}

	/**
	* 大吃小
	*/
	public function dcx() {
		if (isset($_SESSION['WxOpenID'])&&isset($_GET['i'])) {
			$open_id = $_SESSION['WxOpenID'];

			$state = $_GET['i'];
			if(strpos($state, "_") !== false)
			{
					$state_array = explode("_",$state);
					$room_number = $state_array[0];
					$user_code   = $state_array[1];
			} else {
					log_message('error', "function(dcx):state"." in file".__FILE__." on Line ".__LINE__);
					show_404();exit;
			}

			$request_ary['open_id'] = $open_id;
			$request_ary['user_code'] = $user_code;
			$this->load->model('account/account_model','',true);
			$userinfo_result = $this->account_model->getUserInfo($request_ary);
			if(!isset($userinfo_result['data']['account_id']) || $userinfo_result['data']['account_id'] == "")
			{

					$direct_url = base_url("y/dcx/".$_GET['i']);
					Header("Location:".$direct_url);
					return;
			}
			$request_ary['account_id'] = $userinfo_result['data']['account_id'];
			$this->load->model('flower/room_model','',true);
			$result = $this->room_model->getRoomTicket($request_ary);

			$session_request['dealer_num'] = 2;
			$session_request['account_id'] = $userinfo_result['data']['account_id'];
			$session_request['type'] = '';
			$this->load->model('verification_model','',true);
			$sessionResult = $this->verification_model->createRequestSession($session_request);
			$data['session'] = $sessionResult;

			//获取关闭房间积分榜
			$request_ary['game_type'] = 20;
			$request_ary['room_number'] = $room_number;
			$score_result = $this->room_model->getRoomScoreboard($request_ary);
			if(isset($score_result['data']['room_status']) && isset($score_result['data']['balance_scoreboard']))
			{
					$data['room_status'] = $score_result['data']['room_status'];
					$data['balance_scoreboard'] = $this->jsonEncodeOptions($score_result['data']['balance_scoreboard']);
			}
			else
			{
					$data['room_status'] = -1;
					$data['balance_scoreboard'] = "";
			}

			$this->load->model('wechat_model','',true);
			$config_ary = $this->wechat_model->getWxConfig();
			$data['config_ary']=$config_ary;

			$data['user'] = $userinfo_result['data'];
			$data['socket'] = Game_Const::WebSocket_Dcx;
			$data['base_url'] = base_url();
			$data['card'] = $result['data']['ticket_count'];
			$data['room_number'] = $room_number;
//			$data['room_url'] = $data['base_url']."f/dcx?i=".$room_number."_".$userinfo_result['data']['user_code'];
            //增加短码地址生成
            $tcn['url_now'] = $data['base_url']."f/dcx?i=".$room_number."_".$userinfo_result['data']['user_code'];
            $tcn['url_long'] = $this->config->item("short_url").$tcn['url_now'];
            $data['room_url'] = $this->account_model->convertUrl($tcn);
			$data['file_url'] = Game_Const::ImageUrl;
			$data['image_url']= Game_Const::ImageUrl;
			$data['http_url'] = "https://connwss.fairyland.xin/";

			$data['game_type'] = $request_ary['game_type'];
			$data['dealer_num'] = 2;
			$data['open_id'] = '';
			$data['isAuthPhone'] = 0;
			$data['authCardCount'] = 10;
			$data['phone'] = '';

			//广播
			$data['is_announcement']=0;
			$data['announcement_content']='';
			$data['announcement_sec']='0';
			$this->load->model('message/message_model','',true);
			$result = $this->message_model->getGameMessageInfo();
			if ($result['result'] == 0) {
					$data['is_announcement'] = $result['data']['announcement_dict']['is_show'];
					$data['announcement_sec'] = $result['data']['announcement_dict']['total_sec'];
					$aContent = '';
					$arrayContent = $result['data']['announcement_dict']['content_ary'];
					foreach ($arrayContent as $value) {
							$aContent = $aContent.$value;
					}
					$data['announcement_content'] = $aContent;
			}
			// end 广播

			if($score_result['data']['max_count'] == 9){
					$this->load->view("dcx.php",$data);
			} else {
					$this->load->view("dcx12.php",$data);
			}
		}   else if(isset($_GET['i'])) {
				$direct_url = base_url("y/dcx/".$_GET['i']);
				Header("Location:".$direct_url);
		}
	}


    /**
    * 牌九
    */
    public function pj() {
        if (isset($_SESSION['WxOpenID'])&&isset($_GET['i'])) {
                $open_id = $_SESSION['WxOpenID'];

                $state = $_GET['i'];
                if(strpos($state, "_") !== false)
                {
                        $state_array = explode("_",$state);
                        $room_number = $state_array[0];
                        $user_code   = $state_array[1];
                } else {
                        log_message('error', "function(pj):state"." in file".__FILE__." on Line ".__LINE__);
                        show_404();exit;
                }

                $request_ary['open_id'] = $open_id;
                $request_ary['user_code'] = $user_code;
                $this->load->model('account/account_model','',true);
                $userinfo_result = $this->account_model->getUserInfo($request_ary);
                if(!isset($userinfo_result['data']['account_id']) || $userinfo_result['data']['account_id'] == "")
                {

                        $direct_url = base_url("y/pj/".$_GET['i']);
                        Header("Location:".$direct_url);
                        return;
                }
                $request_ary['account_id'] = $userinfo_result['data']['account_id'];
                $this->load->model('flower/room_model','',true);
                $result = $this->room_model->getRoomTicket($request_ary);

                $session_request['dealer_num'] = 2;
                $session_request['account_id'] = $userinfo_result['data']['account_id'];
                $session_request['type'] = '';
                $this->load->model('verification_model','',true);
                $sessionResult = $this->verification_model->createRequestSession($session_request);
                $data['session'] = $sessionResult;

                //获取关闭房间积分榜
                $request_ary['game_type'] = 19;
                $request_ary['room_number'] = $room_number;
                $score_result = $this->room_model->getRoomScoreboard($request_ary);
                if(isset($score_result['data']['room_status']) && isset($score_result['data']['balance_scoreboard']))
                {
                        $data['room_status'] = $score_result['data']['room_status'];
                        $data['balance_scoreboard'] = $this->jsonEncodeOptions($score_result['data']['balance_scoreboard']);
                }
                else
                {
                        $data['room_status'] = -1;
                        $data['balance_scoreboard'] = "";
                }

                $this->load->model('wechat_model','',true);
                $config_ary = $this->wechat_model->getWxConfig();
                $data['config_ary']=$config_ary;

                $data['user'] = $userinfo_result['data'];
                $data['socket'] = Game_Const::WebSocket_PaiJiu;
                $data['base_url'] = base_url();
                $data['card'] = $result['data']['ticket_count'];
                $data['room_number'] = $room_number;
//                $data['room_url'] = $data['base_url']."f/pj?i=".$room_number."_".$userinfo_result['data']['user_code'];
            //增加短码地址生成
            $tcn['url_now'] = $data['base_url']."f/pj?i=".$room_number."_".$userinfo_result['data']['user_code'];
            $tcn['url_long'] = $this->config->item("short_url").$tcn['url_now'];
            $data['room_url'] = $this->account_model->convertUrl($tcn);
                $data['file_url'] = Game_Const::ImageUrl;
                $data['image_url']= Game_Const::ImageUrl;
                $data['http_url'] = "https://connwss.fairyland.xin/";

                $data['game_type'] = 19;
                $data['dealer_num'] = 2;
                $data['open_id'] = '';
                $data['isAuthPhone'] = 0;
                $data['authCardCount'] = 10;
                $data['phone'] = '';

                //广播
                $data['is_announcement']=0;
                $data['announcement_content']='';
                $data['announcement_sec']='0';
                $this->load->model('message/message_model','',true);
                $result = $this->message_model->getGameMessageInfo();
                if ($result['result'] == 0) {
                        $data['is_announcement'] = $result['data']['announcement_dict']['is_show'];
                        $data['announcement_sec'] = $result['data']['announcement_dict']['total_sec'];
                        $aContent = '';
                        $arrayContent = $result['data']['announcement_dict']['content_ary'];
                        foreach ($arrayContent as $value) {
                                $aContent = $aContent.$value;
                        }
                        $data['announcement_content'] = $aContent;
                }
                // end 广播
                $this->load->view("paijiu/paijiu.php",$data);
        }   else if(isset($_GET['i'])) {
                $direct_url = base_url("y/pj/".$_GET['i']);
                Header("Location:".$direct_url);
        }
    }

	/**
	 * 十人牛牛
	 */
	public function b6b() {
		if (isset($_SESSION['WxOpenID'])&&isset($_GET['i'])) {
			$open_id = $_SESSION['WxOpenID'];

			$state = $_GET['i'];
			if(strpos($state, "_") !== false)
			{
				$state_array = explode("_",$state);
				$room_number = $state_array[0];
				$user_code   = $state_array[1];
			} else {
				log_message('error', "function(b6b):state"." in file".__FILE__." on Line ".__LINE__);
				show_404();exit;
			}

			$request_ary['open_id'] = $open_id;
			$request_ary['user_code'] = $user_code;
			$this->load->model('account/account_model','',true);
			$userinfo_result = $this->account_model->getUserInfo($request_ary);
			if(!isset($userinfo_result['data']['account_id']) || $userinfo_result['data']['account_id'] == "")
			{

				$direct_url = base_url("y/b6b/".$_GET['i']);
				Header("Location:".$direct_url);
				return;
				//log_message('error', "function(nb):state"." in file".__FILE__." on Line ".__LINE__);
				//show_404();exit;
			}

			$request_ary['account_id'] = $userinfo_result['data']['account_id'];
			$this->load->model('flower/room_model','',true);
			$result = $this->room_model->getRoomTicket($request_ary);

			$session_request['dealer_num'] = 2;
			$session_request['account_id'] = $userinfo_result['data']['account_id'];
			$session_request['type'] = '';
			$this->load->model('verification_model','',true);
			$sessionResult = $this->verification_model->createRequestSession($session_request);
			$data['session'] = $sessionResult;

			//获取关闭房间积分榜
			$request_ary['game_type'] = 56;
			$request_ary['room_number'] = $room_number;
			$score_result = $this->room_model->getRoomScoreboard($request_ary);
			if(isset($score_result['data']['room_status']) && isset($score_result['data']['balance_scoreboard']))
			{
				$data['room_status'] = $score_result['data']['room_status'];
				$data['balance_scoreboard'] = $this->jsonEncodeOptions($score_result['data']['balance_scoreboard']);
			}
			else
			{
				$data['room_status'] = -1;
				$data['balance_scoreboard'] = "";
			}

			$this->load->model('wechat_model','',true);
			$config_ary = $this->wechat_model->getWxConfig();
			$data['config_ary']=$config_ary;

            $data['game_type'] = 56;
			$data['user'] = $userinfo_result['data'];
			$data['socket'] = Game_Const::WebSocket_Bull6B;
			$data['base_url'] = base_url();
			$data['card'] = $result['data']['ticket_count'];
			$data['room_number'] = $room_number;
//			$data['room_url'] = $data['base_url']."f/b6b?i=".$room_number."_".$userinfo_result['data']['user_code'];
            //增加短码地址生成
            $tcn['url_now'] = $data['base_url']."f/b6b?i=".$room_number."_".$userinfo_result['data']['user_code'];
            $tcn['url_long'] = $this->config->item("short_url").$tcn['url_now'];
            $data['room_url'] = $this->account_model->convertUrl($tcn);
			$data['file_url'] = $data['base_url'];
			$data['image_url']= Game_Const::ImageUrl;
			$data['http_url'] = "https://connwss.fairyland.xin/";

			$data['dealer_num'] = 2;
			$data['open_id'] = '';
			$data['isAuthPhone'] = 0;
			$data['authCardCount'] = 10;
			$data['phone'] = '';

			//广播
			$data['is_announcement']=0;
			$data['announcement_content']='';
			$data['announcement_sec']='0';
			$this->load->model('message/message_model','',true);
			$result = $this->message_model->getGameMessageInfo();
			if ($result['result'] == 0) {
				$data['is_announcement'] = $result['data']['announcement_dict']['is_show'];
				$data['announcement_sec'] = $result['data']['announcement_dict']['total_sec'];
				$aContent = '';
				$arrayContent = $result['data']['announcement_dict']['content_ary'];
				foreach ($arrayContent as $value) {
					$aContent = $aContent.$value;
				}
				$data['announcement_content'] = $aContent;
			}
			// end 广播
			$this->load->view("bull6b/tenbull.php",$data);
		}   else if(isset($_GET['i'])) {
			$direct_url = base_url("y/b6b/".$_GET['i']);
			Header("Location:".$direct_url);
		}
	}

	/**
	 * 9人8倍牛牛
	 */
	 public function b8b() {
		if (isset($_SESSION['WxOpenID'])&&isset($_GET['i'])) {
			$open_id = $_SESSION['WxOpenID'];

			$state = $_GET['i'];
			if(strpos($state, "_") !== false)
			{
				$state_array = explode("_",$state);
				$room_number = $state_array[0];
				$user_code   = $state_array[1];
			} else {
				log_message('error', "function(b6b):state"." in file".__FILE__." on Line ".__LINE__);
				show_404();exit;
			}

			$request_ary['open_id'] = $open_id;
			$request_ary['user_code'] = $user_code;
			$this->load->model('account/account_model','',true);
			$userinfo_result = $this->account_model->getUserInfo($request_ary);
			if(!isset($userinfo_result['data']['account_id']) || $userinfo_result['data']['account_id'] == "")
			{

				$direct_url = base_url("y/b8b/".$_GET['i']);
				Header("Location:".$direct_url);
				return;
			}

			$request_ary['account_id'] = $userinfo_result['data']['account_id'];
			$this->load->model('flower/room_model','',true);
			$result = $this->room_model->getRoomTicket($request_ary);

			$session_request['dealer_num'] = 2;
			$session_request['account_id'] = $userinfo_result['data']['account_id'];
			$session_request['type'] = '';
			$this->load->model('verification_model','',true);
			$sessionResult = $this->verification_model->createRequestSession($session_request);
			$data['session'] = $sessionResult;

			//获取关闭房间积分榜
			$request_ary['game_type'] = 58;
			$request_ary['room_number'] = $room_number;
			$score_result = $this->room_model->getRoomScoreboard($request_ary);
			if(isset($score_result['data']['room_status']) && isset($score_result['data']['balance_scoreboard']))
			{
				$data['room_status'] = $score_result['data']['room_status'];
				$data['balance_scoreboard'] = $this->jsonEncodeOptions($score_result['data']['balance_scoreboard']);
			}
			else
			{
				$data['room_status'] = -1;
				$data['balance_scoreboard'] = "";
			}

			$this->load->model('wechat_model','',true);
			$config_ary = $this->wechat_model->getWxConfig();
			$data['config_ary']=$config_ary;
            $data['game_type'] = 58;
			$data['user'] = $userinfo_result['data'];
			$data['socket'] = Game_Const::WebSocket_Bull8B;
			$data['base_url'] = base_url();
			$data['card'] = $result['data']['ticket_count'];
			$data['room_number'] = $room_number;
//			$data['room_url'] = $data['base_url']."f/b8b?i=".$room_number."_".$userinfo_result['data']['user_code'];
            //增加短码地址生成
            $tcn['url_now'] = $data['base_url']."f/b8b?i=".$room_number."_".$userinfo_result['data']['user_code'];
            $tcn['url_long'] = $this->config->item("short_url").$tcn['url_now'];
            $data['room_url'] = $this->account_model->convertUrl($tcn);
			$data['file_url'] = $data['base_url'];
			$data['image_url']= Game_Const::ImageUrl;
			$data['http_url'] = "https://connwss.fairyland.xin/";

			$data['dealer_num'] = 2;
			$data['open_id'] = '';
			$data['isAuthPhone'] = 0;
			$data['authCardCount'] = 10;
			$data['phone'] = '';

			//广播
			$data['is_announcement']=0;
			$data['announcement_content']='';
			$data['announcement_sec']='0';
			$this->load->model('message/message_model','',true);
			$result = $this->message_model->getGameMessageInfo();
			if ($result['result'] == 0) {
				$data['is_announcement'] = $result['data']['announcement_dict']['is_show'];
				$data['announcement_sec'] = $result['data']['announcement_dict']['total_sec'];
				$aContent = '';
				$arrayContent = $result['data']['announcement_dict']['content_ary'];
				foreach ($arrayContent as $value) {
					$aContent = $aContent.$value;
				}
				$data['announcement_content'] = $aContent;
			}
			// end 广播
			$this->load->view("bull8b/bull8b.php",$data);
		}   else if(isset($_GET['i'])) {
			$direct_url = base_url("y/b8b/".$_GET['i']);
			Header("Location:".$direct_url);
		}
	}


    /**
     * 二八杠房间入口
     */
    public function eba() {
        if (isset($_SESSION['WxOpenID'])&&isset($_GET['i'])) {
            $open_id = $_SESSION['WxOpenID'];

            $state = $_GET['i'];
            if(strpos($state, "_") !== false)
            {
                $state_array = explode("_",$state);
                $room_number = $state_array[0];
                $user_code   = $state_array[1];
            } else {
                log_message('error', "function(eba):state"." in file".__FILE__." on Line ".__LINE__);
                show_404();exit;
            }

            $request_ary['open_id'] = $open_id;
            $request_ary['user_code'] = $user_code;
            $this->load->model('account/account_model','',true);
            $userinfo_result = $this->account_model->getUserInfo($request_ary);
            if(!isset($userinfo_result['data']['account_id']) || $userinfo_result['data']['account_id'] == "")
            {

                $direct_url = base_url("y/eba/".$_GET['i']);
                Header("Location:".$direct_url);
                return;
                //log_message('error', "function(nb):state"." in file".__FILE__." on Line ".__LINE__);
                //show_404();exit;
            }

            $request_ary['account_id'] = $userinfo_result['data']['account_id'];
            $this->load->model('flower/room_model','',true);
            $result = $this->room_model->getRoomTicket($request_ary);

            $session_request['dealer_num'] = 2;
            $session_request['account_id'] = $userinfo_result['data']['account_id'];
            $session_request['type'] = '';
            $this->load->model('verification_model','',true);
            $sessionResult = $this->verification_model->createRequestSession($session_request);
            $data['session'] = $sessionResult;

            //获取关闭房间积分榜
            $request_ary['game_type'] = 8;
            $request_ary['room_number'] = $room_number;
            $score_result = $this->room_model->getRoomScoreboard($request_ary);
            if(isset($score_result['data']['room_status']) && isset($score_result['data']['balance_scoreboard']))
            {
                $data['room_status'] = $score_result['data']['room_status'];
                $data['balance_scoreboard'] = $this->jsonEncodeOptions($score_result['data']['balance_scoreboard']);
            }
            else
            {
                $data['room_status'] = -1;
                $data['balance_scoreboard'] = "";
            }

            $this->load->model('wechat_model','',true);
            $config_ary = $this->wechat_model->getWxConfig();
            $data['config_ary']=$config_ary;

            $data['user'] = $userinfo_result['data'];
            $data['socket'] = Game_Const::WebSocket_EBA;
            $data['base_url'] = base_url();
            $data['card'] = $result['data']['ticket_count'];
            $data['room_number'] = $room_number;
//            $data['room_url'] = $data['base_url']."f/eba?i=".$room_number."_".$userinfo_result['data']['user_code'];
            //增加短码地址生成
            $tcn['url_now'] = $data['base_url']."f/eba?i=".$room_number."_".$userinfo_result['data']['user_code'];
            $tcn['url_long'] = $this->config->item("short_url").$tcn['url_now'];
            $data['room_url'] = $this->account_model->convertUrl($tcn);
            $data['file_url'] = Game_Const::ImageUrl;
            $data['image_url']= Game_Const::ImageUrl;
            $data['http_url'] = "https://connwss.fairyland.xin/";

            $data['dealer_num'] = 2;
            $data['open_id'] = '';
            $data['isAuthPhone'] = 0;
            $data['authCardCount'] = 10;
            $data['phone'] = '';
			//广播
			$data['is_announcement']=0;
			$data['announcement_content']='';
			$data['announcement_sec']='0';
			$this->load->model('message/message_model','',true);
			$result = $this->message_model->getGameMessageInfo();
			if ($result['result'] == 0) {
				$data['is_announcement'] = $result['data']['announcement_dict']['is_show'];
				$data['announcement_sec'] = $result['data']['announcement_dict']['total_sec'];
				$aContent = '';
				$arrayContent = $result['data']['announcement_dict']['content_ary'];
				foreach ($arrayContent as $value) {
					$aContent = $aContent.$value;
				}
				$data['announcement_content'] = $aContent;
			}
			// end 广播
            $this->load->view("eba/eba.php",$data);
        }   else if(isset($_GET['i'])) {
            $direct_url = base_url("y/eba/".$_GET['i']);
            Header("Location:".$direct_url);
        }
    }

    /**
     * 三公房间入口
     */
    public function sg() {

        if (isset($_SESSION['WxOpenID'])&&isset($_GET['i'])) {
            $open_id = $_SESSION['WxOpenID'];

            $state = $_GET['i'];
            if(strpos($state, "_") !== false)
            {
                $state_array = explode("_",$state);
                $room_number = $state_array[0];
                $user_code   = $state_array[1];
            } else {
                log_message('error', "function(sg):state"." in file".__FILE__." on Line ".__LINE__);
                show_404();exit;
            }

            $request_ary['open_id'] = $open_id;
            $request_ary['user_code'] = $user_code;
            $this->load->model('account/account_model','',true);
            $userinfo_result = $this->account_model->getUserInfo($request_ary);
            if(!isset($userinfo_result['data']['account_id']) || $userinfo_result['data']['account_id'] == "")
            {

                $direct_url = base_url("y/sg/".$_GET['i']);
                Header("Location:".$direct_url);
                return;
                //log_message('error', "function(nb):state"." in file".__FILE__." on Line ".__LINE__);
                //show_404();exit;
            }

            $request_ary['account_id'] = $userinfo_result['data']['account_id'];
            $this->load->model('flower/room_model','',true);
            $result = $this->room_model->getRoomTicket($request_ary);

            $session_request['dealer_num'] = 2;
            $session_request['account_id'] = $userinfo_result['data']['account_id'];
            $session_request['type'] = '';
            $this->load->model('verification_model','',true);
            $sessionResult = $this->verification_model->createRequestSession($session_request);
            $data['session'] = $sessionResult;

            //获取关闭房间积分榜
            $request_ary['game_type'] = 3;
            $request_ary['room_number'] = $room_number;
            $score_result = $this->room_model->getRoomScoreboard($request_ary);
            if(isset($score_result['data']['room_status']) && isset($score_result['data']['balance_scoreboard']))
            {
                $data['room_status'] = $score_result['data']['room_status'];
                $data['balance_scoreboard'] = $this->jsonEncodeOptions($score_result['data']['balance_scoreboard']);
            }
            else
            {
                $data['room_status'] = -1;
                $data['balance_scoreboard'] = "";
            }

            $this->load->model('wechat_model','',true);
            $config_ary = $this->wechat_model->getWxConfig();
            $data['config_ary']=$config_ary;

            $data['user'] = $userinfo_result['data'];
            $data['socket'] = Game_Const::WebSocket_SG;
            $data['base_url'] = base_url();
            $data['card'] = $result['data']['ticket_count'];
            $data['room_number'] = $room_number;
//            $data['room_url'] = $data['base_url']."f/sg?i=".$room_number."_".$userinfo_result['data']['user_code'];
            //增加短码地址生成
            $tcn['url_now'] = $data['base_url']."f/sg?i=".$room_number."_".$userinfo_result['data']['user_code'];
            $tcn['url_long'] = $this->config->item("short_url").$tcn['url_now'];
            $data['room_url'] = $this->account_model->convertUrl($tcn);
            $data['file_url'] = Game_Const::ImageUrl;
            $data['image_url']= Game_Const::ImageUrl;
            $data['http_url'] = "https://connwss.fairyland.xin/";

            $data['dealer_num'] = 2;
            $data['open_id'] = '';
            $data['isAuthPhone'] = 0;
            $data['authCardCount'] = 10;
            $data['phone'] = '';


            //公告
            $data['is_announcement']=0;
            $data['announcement_content']='';
            $data['announcement_sec']='0';

            $this->load->model('message/message_model','',true);
            $result = $this->message_model->getGameMessageInfo();

            if ($result['result'] == 0) {
                $data['is_announcement'] = $result['data']['announcement_dict']['is_show'];
                $data['announcement_sec'] = $result['data']['announcement_dict']['total_sec'];

                $aContent = '';
                $arrayContent = $result['data']['announcement_dict']['content_ary'];
                foreach ($arrayContent as $value) {
                    $aContent = $aContent.$value;
                }

                $data['announcement_content'] = $aContent;
            }

            $this->load->view("sg/sg.php",$data);
        }   else if(isset($_GET['i'])) {
            $direct_url = base_url("y/sg/".$_GET['i']);
            Header("Location:".$direct_url);
        }
    }


	/**
	 * 9人牛牛
	 */
	public function nb() {

		if (isset($_SESSION['WxOpenID'])&&isset($_GET['i'])) {
			$open_id = $_SESSION['WxOpenID'];

			$state = $_GET['i'];
			if(strpos($state, "_") !== false)
			{
				$state_array = explode("_",$state);
				$room_number = $state_array[0];
				$user_code   = $state_array[1];
			} else {
				log_message('error', "function(nb):state"." in file".__FILE__." on Line ".__LINE__);
				show_404();exit;
			}

			$request_ary['open_id'] = $open_id;
			$request_ary['user_code'] = $user_code;
			$this->load->model('account/account_model','',true);
			$userinfo_result = $this->account_model->getUserInfo($request_ary);
			if(!isset($userinfo_result['data']['account_id']) || $userinfo_result['data']['account_id'] == "")
			{

				$direct_url = base_url("y/nb/".$_GET['i']);
				Header("Location:".$direct_url);
				return;
				//log_message('error', "function(nb):state"." in file".__FILE__." on Line ".__LINE__);
				//show_404();exit;
			}

			$request_ary['account_id'] = $userinfo_result['data']['account_id'];
			$this->load->model('flower/room_model','',true);
			$result = $this->room_model->getRoomTicket($request_ary);

			$session_request['dealer_num'] = 2;
			$session_request['account_id'] = $userinfo_result['data']['account_id'];
			$session_request['type'] = '';
			$this->load->model('verification_model','',true);
			$sessionResult = $this->verification_model->createRequestSession($session_request);
			$data['session'] = $sessionResult;

			//获取关闭房间积分榜
			$request_ary['game_type'] = 59;
			$request_ary['room_number'] = $room_number;
			$score_result = $this->room_model->getRoomScoreboard($request_ary);
			if(isset($score_result['data']['room_status']) && isset($score_result['data']['balance_scoreboard']))
			{
				$data['room_status'] = $score_result['data']['room_status'];
				$data['balance_scoreboard'] = $this->jsonEncodeOptions($score_result['data']['balance_scoreboard']);
			}
			else
			{
				$data['room_status'] = -1;
				$data['balance_scoreboard'] = "";
			}

			$this->load->model('wechat_model','',true);
			$config_ary = $this->wechat_model->getWxConfig();
			$data['config_ary']=$config_ary;
            $data['game_type'] = 59;
			$data['user'] = $userinfo_result['data'];
			$data['socket'] = Game_Const::WebSocket_Bull9;
			$data['base_url'] = base_url();
			$data['card'] = $result['data']['ticket_count'];
			$data['room_number'] = $room_number;
//			$data['room_url'] = $data['base_url']."f/nb?i=".$room_number."_".$userinfo_result['data']['user_code'];
            //增加短码地址生成
            $tcn['url_now'] = $data['base_url']."f/nb?i=".$room_number."_".$userinfo_result['data']['user_code'];
            $tcn['url_long'] = $this->config->item("short_url").$tcn['url_now'];
            $data['room_url'] = $this->account_model->convertUrl($tcn);
			$data['file_url'] = $data['base_url'];
			$data['image_url']= Game_Const::ImageUrl; 
			$data['http_url'] = "https://connwss.fairyland.xin/";

			$data['dealer_num'] = 2;
			$data['open_id'] = '';
			$data['isAuthPhone'] = 0;
			$data['authCardCount'] = 10;
			$data['phone'] = '';
			//广播
			$data['is_announcement']=0;
			$data['announcement_content']='';
			$data['announcement_sec']='0';
			$this->load->model('message/message_model','',true);
			$result = $this->message_model->getGameMessageInfo();
			if ($result['result'] == 0) {
				$data['is_announcement'] = $result['data']['announcement_dict']['is_show'];
				$data['announcement_sec'] = $result['data']['announcement_dict']['total_sec'];
				$aContent = '';
				$arrayContent = $result['data']['announcement_dict']['content_ary'];
				foreach ($arrayContent as $value) {
					$aContent = $aContent.$value;
				}
				$data['announcement_content'] = $aContent;
			}
			// end 广播
			$this->load->view("bull9/bull9.php",$data);	
		}   else if(isset($_GET['i'])) {			
			$direct_url = base_url("y/nb/".$_GET['i']);
			Header("Location:".$direct_url);
		} 
	}

	/**
	 * 12人牛牛
	 */
    public function mb() {

        if (isset($_SESSION['WxOpenID'])&&isset($_GET['i'])) {
            $open_id = $_SESSION['WxOpenID'];

            $state = $_GET['i'];
            if(strpos($state, "_") !== false)
            {
                $state_array = explode("_",$state);
                $room_number = $state_array[0];
                $user_code   = $state_array[1];
            } else {
                log_message('error', "function(mb):state"." in file".__FILE__." on Line ".__LINE__);
                show_404();exit;
            }

            $request_ary['open_id'] = $open_id;
            $request_ary['user_code'] = $user_code;
            $this->load->model('account/account_model','',true);
            $userinfo_result = $this->account_model->getUserInfo($request_ary);
            if(!isset($userinfo_result['data']['account_id']) || $userinfo_result['data']['account_id'] == "")
            {

                $direct_url = base_url("y/mb/".$_GET['i']);
                Header("Location:".$direct_url);
                return;
                //log_message('error', "function(nb):state"." in file".__FILE__." on Line ".__LINE__);
                //show_404();exit;
            }

            $request_ary['account_id'] = $userinfo_result['data']['account_id'];
            $this->load->model('flower/room_model','',true);
            $result = $this->room_model->getRoomTicket($request_ary);

            $session_request['dealer_num'] = 2;
            $session_request['account_id'] = $userinfo_result['data']['account_id'];
            $session_request['type'] = '';
            $this->load->model('verification_model','',true);
            $sessionResult = $this->verification_model->createRequestSession($session_request);
            $data['session'] = $sessionResult;

            //获取关闭房间积分榜
            $request_ary['game_type'] = 52;
            $request_ary['room_number'] = $room_number;
            $score_result = $this->room_model->getRoomScoreboard($request_ary);
            if(isset($score_result['data']['room_status']) && isset($score_result['data']['balance_scoreboard']))
            {
                $data['room_status'] = $score_result['data']['room_status'];
                $data['balance_scoreboard'] = $this->jsonEncodeOptions($score_result['data']['balance_scoreboard']);
            }
            else
            {
                $data['room_status'] = -1;
                $data['balance_scoreboard'] = "";
            }

            $this->load->model('wechat_model','',true);
            $config_ary = $this->wechat_model->getWxConfig();
            $data['config_ary']=$config_ary;
            $data['game_type'] = 52;
            $data['user'] = $userinfo_result['data'];
            $data['socket'] = Game_Const::WebSocket_Bull12;
            $data['base_url'] = base_url();
            $data['card'] = $result['data']['ticket_count'];
            $data['room_number'] = $room_number;
//            $data['room_url'] = $data['base_url']."f/mb?i=".$room_number."_".$userinfo_result['data']['user_code'];
            //增加短码地址生成
            $tcn['url_now'] = $data['base_url']."f/mb?i=".$room_number."_".$userinfo_result['data']['user_code'];
            $tcn['url_long'] = $this->config->item("short_url").$tcn['url_now'];
            $data['room_url'] = $this->account_model->convertUrl($tcn);
            $data['file_url'] = Game_Const::ImageUrl;
            $data['image_url']= Game_Const::ImageUrl;
            $data['http_url'] = "https://connwss.fairyland.xin/";
            $data['game_type'] = 52;
            $data['dealer_num'] = 2;
            $data['open_id'] = '';
            $data['isAuthPhone'] = 0;
            $data['authCardCount'] = 10;
            $data['phone'] = '';
			//广播
			$data['is_announcement']=0;
			$data['announcement_content']='';
			$data['announcement_sec']='0';
			$this->load->model('message/message_model','',true);
			$result = $this->message_model->getGameMessageInfo();
			if ($result['result'] == 0) {
				$data['is_announcement'] = $result['data']['announcement_dict']['is_show'];
				$data['announcement_sec'] = $result['data']['announcement_dict']['total_sec'];
				$aContent = '';
				$arrayContent = $result['data']['announcement_dict']['content_ary'];
				foreach ($arrayContent as $value) {
					$aContent = $aContent.$value;
				}
				$data['announcement_content'] = $aContent;
			}
			// end 广播
            $this->load->view("bull12/bull12.php",$data);
        }   else if(isset($_GET['i'])) {
            $direct_url = base_url("y/mb/".$_GET['i']);
            Header("Location:".$direct_url);
        }
    }

	/**
	 * 6人牛牛
	 */
	public function b() {

		if (isset($_SESSION['WxOpenID'])&&isset($_GET['i'])) {
			$open_id = $_SESSION['WxOpenID'];

			$state = $_GET['i'];
			if(strpos($state, "_") !== false)
			{
				$state_array = explode("_",$state);
				$room_number = $state_array[0];
				$user_code   = $state_array[1];
			} else {
				log_message('error', "function(b):state"." in file".__FILE__." on Line ".__LINE__);
				show_404();exit;
			}

			$request_ary['open_id'] = $open_id;
			$request_ary['user_code'] = $user_code;
			$this->load->model('account/account_model','',true);

            //查询用户信息
			$userinfo_result = $this->account_model->getUserInfo($request_ary);

			if(!isset($userinfo_result['data']['account_id']) || $userinfo_result['data']['account_id'] == "")
			{
				log_message('error', "function(b):state"." in file".__FILE__." on Line ".__LINE__);
				show_404();exit;
			}

			$request_ary['account_id'] = $userinfo_result['data']['account_id'];
			$this->load->model('flower/room_model','',true);
			$result = $this->room_model->getRoomTicket($request_ary);

			$session_request['dealer_num'] = 2;
			$session_request['account_id'] = $userinfo_result['data']['account_id'];
			$session_request['type'] = '';
			$this->load->model('verification_model','',true);
			$sessionResult = $this->verification_model->createRequestSession($session_request);
			$data['session'] = $sessionResult;

			//获取关闭房间积分榜
			$request_ary['game_type'] = 55;
			$request_ary['room_number'] = $room_number;
			$score_result = $this->room_model->getRoomScoreboard($request_ary);
			if(isset($score_result['data']['room_status']) && isset($score_result['data']['balance_scoreboard']))
			{
				$data['room_status'] = $score_result['data']['room_status'];
				$data['balance_scoreboard'] = $this->jsonEncodeOptions($score_result['data']['balance_scoreboard']);
			}
			else
			{
				$data['room_status'] = -1;
				$data['balance_scoreboard'] = "";
			}

			$this->load->model('wechat_model','',true);
			$config_ary = $this->wechat_model->getWxConfig();
			$data['config_ary']=$config_ary;
            $data['game_type'] = 55;
			$data['user'] = $userinfo_result['data'];
			$data['socket'] = Game_Const::WebSocket_Bull;
			$data['base_url'] = base_url();
			$data['card'] = $result['data']['ticket_count'];
			$data['room_number'] = $room_number;
//			$data['room_url'] = $data['base_url']."f/b?i=".$room_number."_".$userinfo_result['data']['user_code'];
            //增加短码地址生成
            $tcn['url_now'] = $data['base_url']."f/b?i=".$room_number."_".$userinfo_result['data']['user_code'];
            $tcn['url_long'] = $this->config->item("short_url").$tcn['url_now'];
            $data['room_url'] = $this->account_model->convertUrl($tcn);
			$data['file_url'] = $data['base_url'];
			$data['image_url']= Game_Const::ImageUrl; 
			$data['http_url'] = "https://connwss.fairyland.xin/";

			$data['dealer_num'] = 2;
			$data['open_id'] = '';
			$data['isAuthPhone'] = 0;
			$data['authCardCount'] = 10;
			$data['phone'] = '';
			//广播
			$data['is_announcement']=0;
			$data['announcement_content']='';
			$data['announcement_sec']='0';
			$this->load->model('message/message_model','',true);
			$result = $this->message_model->getGameMessageInfo();
			if ($result['result'] == 0) {
				$data['is_announcement'] = $result['data']['announcement_dict']['is_show'];
				$data['announcement_sec'] = $result['data']['announcement_dict']['total_sec'];
				$aContent = '';
				$arrayContent = $result['data']['announcement_dict']['content_ary'];
				foreach ($arrayContent as $value) {
					$aContent = $aContent.$value;
				}
				$data['announcement_content'] = $aContent;
			}
			// end 广播
			$this->load->view("bull/tableBull.php",$data);	
		}   else if(isset($_GET['i'])) {			
			$direct_url = base_url("y/b/".$_GET['i']);
			Header("Location:".$direct_url);
		}  
	}

	/**
	 * 麻将
	 */
	public function ma() {

		if (isset($_SESSION['WxOpenID'])&&isset($_GET['i'])) {
			$open_id = $_SESSION['WxOpenID'];

			$state = $_GET['i'];
			if(strpos($state, "_") !== false)
			{
				$state_array = explode("_",$state);
				$room_number = $state_array[0];
				$user_code   = $state_array[1];
			} else {
				log_message('error', "function(b):state"." in file".__FILE__." on Line ".__LINE__);
				show_404();exit;
			}

			$request_ary['open_id'] = $open_id;
			$request_ary['user_code'] = $user_code;
			$this->load->model('account/account_model','',true);
			$userinfo_result = $this->account_model->getUserInfo($request_ary);
			if(!isset($userinfo_result['data']['account_id']) || $userinfo_result['data']['account_id'] == "")
			{
				log_message('error', "function(b):state"." in file".__FILE__." on Line ".__LINE__);
				show_404();exit;
			}

			$request_ary['account_id'] = $userinfo_result['data']['account_id'];
			$this->load->model('flower/room_model','',true);
			$result = $this->room_model->getRoomTicket($request_ary);

			$session_request['dealer_num'] = 2;
			$session_request['account_id'] = $userinfo_result['data']['account_id'];
			$session_request['type'] = '';
			$this->load->model('verification_model','',true);
			$sessionResult = $this->verification_model->createRequestSession($session_request);
			$data['session'] = $sessionResult;

			//获取关闭房间积分榜
			$request_ary['game_type'] = 6;
			$request_ary['room_number'] = $room_number;
			$score_result = $this->room_model->getRoomScoreboard($request_ary);
			if(isset($score_result['data']['room_status']) && isset($score_result['data']['balance_scoreboard']))
			{
				$data['room_status'] = $score_result['data']['room_status'];
				$data['balance_scoreboard'] = $this->jsonEncodeOptions($score_result['data']['balance_scoreboard']);
			}
			else
			{
				$data['room_status'] = -1;
				$data['balance_scoreboard'] = "";
			}

			$this->load->model('wechat_model','',true);
			$config_ary = $this->wechat_model->getWxConfig();
			$data['config_ary']=$config_ary;

			$data['user'] = $userinfo_result['data'];
			$data['socket'] = Game_Const::WebSocket_Gdmj;
			$data['base_url'] = base_url();
			$data['card'] = $result['data']['ticket_count'];
			$data['room_number'] = $room_number;
//			$data['room_url'] = $data['base_url']."f/ma?i=".$room_number."_".$userinfo_result['data']['user_code'];
            //增加短码地址生成
            $tcn['url_now'] = $data['base_url']."f/ma?i=".$room_number."_".$userinfo_result['data']['user_code'];
            $tcn['url_long'] = $this->config->item("short_url").$tcn['url_now'];
            $data['room_url'] = $this->account_model->convertUrl($tcn);
			$data['file_url'] = Game_Const::ImageUrl; 
			$data['image_url']= Game_Const::ImageUrl; 
			$data['http_url'] = "https://connwss.fairyland.xin/";

			$data['dealer_num'] = 2;
			$data['open_id'] = '';
			$data['isAuthPhone'] = 0;
			$data['authCardCount'] = 10;
			$data['phone'] = '';
			//广播
			$data['is_announcement']=0;
			$data['announcement_content']='';
			$data['announcement_sec']='0';
			$this->load->model('message/message_model','',true);
			$result = $this->message_model->getGameMessageInfo();
			if ($result['result'] == 0) {
				$data['is_announcement'] = $result['data']['announcement_dict']['is_show'];
				$data['announcement_sec'] = $result['data']['announcement_dict']['total_sec'];
				$aContent = '';
				$arrayContent = $result['data']['announcement_dict']['content_ary'];
				foreach ($arrayContent as $value) {
					$aContent = $aContent.$value;
				}
				$data['announcement_content'] = $aContent;
			}
			// end 广播
			$this->load->view("majiang/majiang.php",$data);	
		}   else if(isset($_GET['i'])) {			
			$direct_url = base_url("y/ma/".$_GET['i']);
			Header("Location:".$direct_url);
		}  
	}

	//斗地主
	public function l() {

		if (isset($_SESSION['WxOpenID'])&&isset($_GET['i'])) {
			$open_id = $_SESSION['WxOpenID'];

			$state = $_GET['i'];
			if(strpos($state, "_") !== false)
			{
				$state_array = explode("_",$state);
				$room_number = $state_array[0];
				$user_code   = $state_array[1];
			} else {
				log_message('error', "function(l):state"." in file".__FILE__." on Line ".__LINE__);
				show_404();exit;
			}

			$request_ary['open_id'] = $open_id;
			$request_ary['user_code'] = $user_code;
			$this->load->model('account/account_model','',true);
			$userinfo_result = $this->account_model->getUserInfo($request_ary);
			if(!isset($userinfo_result['data']['account_id']) || $userinfo_result['data']['account_id'] == "")
			{
				log_message('error', "function(l):state"." in file".__FILE__." on Line ".__LINE__);
				show_404();exit;
			}

			$request_ary['account_id'] = $userinfo_result['data']['account_id'];
			$this->load->model('flower/room_model','',true);
			$result = $this->room_model->getRoomTicket($request_ary);

			$session_request['dealer_num'] = 2;
			$session_request['account_id'] = $userinfo_result['data']['account_id'];
			$session_request['type'] = '';
			$this->load->model('verification_model','',true);
			$sessionResult = $this->verification_model->createRequestSession($session_request);
			$data['session'] = $sessionResult;

			//获取关闭房间积分榜
			$request_ary['game_type'] = 2;
			$request_ary['room_number'] = $room_number;
			$score_result = $this->room_model->getRoomScoreboard($request_ary);
			if(isset($score_result['data']['room_status']) && isset($score_result['data']['balance_scoreboard']))
			{
				$data['room_status'] = $score_result['data']['room_status'];
				$data['balance_scoreboard'] = $this->jsonEncodeOptions($score_result['data']['balance_scoreboard']);
			}
			else
			{
				$data['room_status'] = -1;
				$data['balance_scoreboard'] = "";
			}

			$this->load->model('wechat_model','',true);
			$config_ary = $this->wechat_model->getWxConfig();
			$data['config_ary']=$config_ary;

			$data['user'] = $userinfo_result['data'];
			$data['socket'] = Game_Const::WebSocket_Landlord;
			$data['base_url'] = base_url();
			$data['card'] = $result['data']['ticket_count'];
			$data['room_number'] = $room_number;
//			$data['room_url'] = $data['base_url']."f/l?i=".$room_number."_".$userinfo_result['data']['user_code'];
            //增加短码地址生成
            $tcn['url_now'] = $data['base_url']."f/l?i=".$room_number."_".$userinfo_result['data']['user_code'];
            $tcn['url_long'] = $this->config->item("short_url").$tcn['url_now'];
            $data['room_url'] = $this->account_model->convertUrl($tcn);
			$data['file_url'] = $data['base_url'];
			$data['image_url']= Game_Const::ImageUrl; 
			$data['http_url'] = "https://connwss.fairyland.xin/";

			$data['dealer_num'] = 2;
			$data['open_id'] = '';
			$data['isAuthPhone'] = 0;
			$data['authCardCount'] = 10;
			$data['phone'] = '';
			//广播
			$data['is_announcement']=0;
			$data['announcement_content']='';
			$data['announcement_sec']='0';
			$this->load->model('message/message_model','',true);
			$result = $this->message_model->getGameMessageInfo();
			if ($result['result'] == 0) {
				$data['is_announcement'] = $result['data']['announcement_dict']['is_show'];
				$data['announcement_sec'] = $result['data']['announcement_dict']['total_sec'];
				$aContent = '';
				$arrayContent = $result['data']['announcement_dict']['content_ary'];
				foreach ($arrayContent as $value) {
					$aContent = $aContent.$value;
				}
				$data['announcement_content'] = $aContent;
			}
			// end 广播
			$this->load->view("landlord/landlord.php",$data);	
		}   else if(isset($_GET['i'])) {			
			$direct_url = base_url("y/l/".$_GET['i']);
			Header("Location:".$direct_url);
		}  
	}


    //炸金花
	public function yf()
	{
		if (isset($_SESSION['WxOpenID'])&&isset($_GET['i'])) {
			$open_id = $_SESSION['WxOpenID'];

			$state = $_GET['i'];
			$user_code = "";
			if(strpos($state, "_") !== false)
			{
				$state_array = explode("_",$state);
				$room_number = $state_array[0];
				$user_code   = $state_array[1];
			} else {
				log_message('error', "function(yf):state"." in file".__FILE__." on Line ".__LINE__);
				show_404();exit;
			}
			$request_ary['open_id'] = $open_id;
			$request_ary['user_code'] = $user_code;
			$this->load->model('account/account_model','',true);
			$userinfo_result = $this->account_model->getUserInfo($request_ary);
			if(!isset($userinfo_result['data']['account_id']) || $userinfo_result['data']['account_id'] == "")
			{
				log_message('error', "function(nb):state"." in file".__FILE__." on Line ".__LINE__);
				show_404();exit;
			}

			$request_ary['account_id'] = $userinfo_result['data']['account_id'];
			$this->load->model('flower/room_model','',true);
			$result = $this->room_model->getRoomTicket($request_ary);

			$session_request['dealer_num'] = 2;
			$session_request['account_id'] = $userinfo_result['data']['account_id'];
			$session_request['type'] = '';
			$this->load->model('verification_model','',true);
			$sessionResult = $this->verification_model->createRequestSession($session_request);
			$data['session'] = $sessionResult;

			//获取关闭房间积分榜
			$request_ary['game_type'] = 1;
			$request_ary['room_number'] = $room_number;
			$score_result = $this->room_model->getRoomScoreboard($request_ary);
			if(isset($score_result['data']['room_status']) && isset($score_result['data']['balance_scoreboard']))
			{
				$data['room_status'] = $score_result['data']['room_status'];
				$data['balance_scoreboard'] = $this->jsonEncodeOptions($score_result['data']['balance_scoreboard']);
			}
			else
			{
				$data['room_status'] = -1;
				$data['balance_scoreboard'] = "";
			}

			$this->load->model('wechat_model','',true);
			$config_ary = $this->wechat_model->getWxConfig();
			$data['config_ary']=$config_ary;

			$data['user'] = $userinfo_result['data'];
			$data['socket'] = Game_Const::WebSocket_Host;
			$data['base_url'] = base_url();
			$data['card'] = $result['data']['ticket_count'];
			$data['room_number'] = $room_number;
//			$data['room_url'] = $data['base_url']."f/yf?i=".$room_number."_".$userinfo_result['data']['user_code'];
            //增加短码地址生成
            $tcn['url_now'] = $data['base_url']."f/yf?i=".$room_number."_".$userinfo_result['data']['user_code'];
            $tcn['url_long'] = $this->config->item("short_url").$tcn['url_now'];
            $data['room_url'] = $this->account_model->convertUrl($tcn);
			$data['file_url'] = $data['base_url']; 
			$data['image_url']= Game_Const::ImageUrl; 
			$data['http_url'] = "https://connwss.fairyland.xin/";

			$data['dealer_num'] = 2;
			$data['open_id'] = '';
			$data['isAuthPhone'] = 0;
			$data['authCardCount'] = 10;
			$data['phone'] = '';
			//广播
			$data['is_announcement']=0;
			$data['announcement_content']='';
			$data['announcement_sec']='0';
			$this->load->model('message/message_model','',true);
			$result = $this->message_model->getGameMessageInfo();
			if ($result['result'] == 0) {
				$data['is_announcement'] = $result['data']['announcement_dict']['is_show'];
				$data['announcement_sec'] = $result['data']['announcement_dict']['total_sec'];
				$aContent = '';
				$arrayContent = $result['data']['announcement_dict']['content_ary'];
				foreach ($arrayContent as $value) {
					$aContent = $aContent.$value;
				}
				$data['announcement_content'] = $aContent;
			}
			// end 广播
			$this->load->view("flower/main.php",$data);	

		}   else if(isset($_GET['i'])) {			
			$direct_url = base_url("y/yf/".$_GET['i']);
			Header("Location:".$direct_url);
		} 
	}
	
    //9人炸金花
	public function z9()
	{
		if (isset($_SESSION['WxOpenID'])&&isset($_GET['i'])) {
			$open_id = $_SESSION['WxOpenID'];

			$state = $_GET['i'];
			$user_code = "";
			if(strpos($state, "_") !== false)
			{
				$state_array = explode("_",$state);
				$room_number = $state_array[0];
				$user_code   = $state_array[1];
			} else {
				log_message('error', "function(z9):state"." in file".__FILE__." on Line ".__LINE__);
				show_404();exit;
			}
			$request_ary['open_id'] = $open_id;
			$request_ary['user_code'] = $user_code;
			$this->load->model('account/account_model','',true);
			$userinfo_result = $this->account_model->getUserInfo($request_ary);
			if(!isset($userinfo_result['data']['account_id']) || $userinfo_result['data']['account_id'] == "")
			{
				log_message('error', "function(z9):state"." in file".__FILE__." on Line ".__LINE__);
				show_404();exit;
			}

			$request_ary['account_id'] = $userinfo_result['data']['account_id'];
			$this->load->model('flower/room_model','',true);
			$result = $this->room_model->getRoomTicket($request_ary);

			$session_request['dealer_num'] = 2;
			$session_request['account_id'] = $userinfo_result['data']['account_id'];
			$session_request['type'] = '';
			$this->load->model('verification_model','',true);
			$sessionResult = $this->verification_model->createRequestSession($session_request);
			$data['session'] = $sessionResult;

			//获取关闭房间积分榜
			$request_ary['game_type'] = 29;
			$request_ary['room_number'] = $room_number;
			$score_result = $this->room_model->getRoomScoreboard($request_ary);
			if(isset($score_result['data']['room_status']) && isset($score_result['data']['balance_scoreboard']))
			{
				$data['room_status'] = $score_result['data']['room_status'];
				$data['balance_scoreboard'] = $this->jsonEncodeOptions($score_result['data']['balance_scoreboard']);
			}
			else
			{
				$data['room_status'] = -1;
				$data['balance_scoreboard'] = "";
			}

			$this->load->model('wechat_model','',true);
			$config_ary = $this->wechat_model->getWxConfig();
			$data['config_ary']=$config_ary;

			$data['user'] = $userinfo_result['data'];
			$data['socket'] = Game_Const::WebSocket_Zjh9;
			$data['base_url'] = base_url();
			$data['card'] = $result['data']['ticket_count'];
			$data['room_number'] = $room_number;
//			$data['room_url'] = $data['base_url']."f/z9?i=".$room_number."_".$userinfo_result['data']['user_code'];
            //增加短码地址生成
            $tcn['url_now'] = $data['base_url']."f/z9?i=".$room_number."_".$userinfo_result['data']['user_code'];
            $tcn['url_long'] = $this->config->item("short_url").$tcn['url_now'];
            $data['room_url'] = $this->account_model->convertUrl($tcn);
			$data['file_url'] = Game_Const::ImageUrl; 
			$data['image_url']= Game_Const::ImageUrl; 
			$data['http_url'] = "https://connwss.fairyland.xin/";

			$data['dealer_num'] = 2;
			$data['open_id'] = '';
			$data['isAuthPhone'] = 0;
			$data['authCardCount'] = 10;
			$data['phone'] = '';
			//广播
			$data['is_announcement']=0;
			$data['announcement_content']='';
			$data['announcement_sec']='0';
			$this->load->model('message/message_model','',true);
			$result = $this->message_model->getGameMessageInfo();
			if ($result['result'] == 0) {
				$data['is_announcement'] = $result['data']['announcement_dict']['is_show'];
				$data['announcement_sec'] = $result['data']['announcement_dict']['total_sec'];
				$aContent = '';
				$arrayContent = $result['data']['announcement_dict']['content_ary'];
				foreach ($arrayContent as $value) {
					$aContent = $aContent.$value;
				}
				$data['announcement_content'] = $aContent;
			}
			// end 广播
			$this->load->view("z9/z9.php",$data);	
		}   else if(isset($_GET['i'])) {			
			$direct_url = base_url("y/z9/".$_GET['i']);
			Header("Location:".$direct_url);
		} 
	}

    /**
     * 12人炸金花
     */
    public function z12()
    {
        if (isset($_SESSION['WxOpenID'])&&isset($_GET['i'])) {
            $open_id = $_SESSION['WxOpenID'];

            $state = $_GET['i'];
            $user_code = "";
            if(strpos($state, "_") !== false)
            {
                $state_array = explode("_",$state);
                $room_number = $state_array[0];
                $user_code   = $state_array[1];
            } else {
                log_message('error', "function(z12):state"." in file".__FILE__." on Line ".__LINE__);
                show_404();exit;
            }
            $request_ary['open_id'] = $open_id;
            $request_ary['user_code'] = $user_code;
            $this->load->model('account/account_model','',true);
            $userinfo_result = $this->account_model->getUserInfo($request_ary);
            if(!isset($userinfo_result['data']['account_id']) || $userinfo_result['data']['account_id'] == "")
            {
                log_message('error', "function(z12):state"." in file".__FILE__." on Line ".__LINE__);
                show_404();exit;
            }

            $request_ary['account_id'] = $userinfo_result['data']['account_id'];
            $this->load->model('flower/room_model','',true);
            $result = $this->room_model->getRoomTicket($request_ary);

            $session_request['dealer_num'] = 2;
            $session_request['account_id'] = $userinfo_result['data']['account_id'];
            $session_request['type'] = '';
            $this->load->model('verification_model','',true);
            $sessionResult = $this->verification_model->createRequestSession($session_request);
            $data['session'] = $sessionResult;

            //获取关闭房间积分榜
            $request_ary['game_type'] = 30;
            $request_ary['room_number'] = $room_number;
            $score_result = $this->room_model->getRoomScoreboard($request_ary);
            if(isset($score_result['data']['room_status']) && isset($score_result['data']['balance_scoreboard']))
            {
                $data['room_status'] = $score_result['data']['room_status'];
                $data['balance_scoreboard'] = $this->jsonEncodeOptions($score_result['data']['balance_scoreboard']);
            }
            else
            {
                $data['room_status'] = -1;
                $data['balance_scoreboard'] = "";
            }

            $this->load->model('wechat_model','',true);
            $config_ary = $this->wechat_model->getWxConfig();
            $data['config_ary']=$config_ary;

            $data['user'] = $userinfo_result['data'];
            $data['socket'] = Game_Const::WebSocket_Zjh12;
            $data['base_url'] = base_url();
            $data['card'] = $result['data']['ticket_count'];
            $data['room_number'] = $room_number;
//            $data['room_url'] = $data['base_url']."f/z12?i=".$room_number."_".$userinfo_result['data']['user_code'];
            //增加短码地址生成
            $tcn['url_now'] = $data['base_url']."f/z12?i=".$room_number."_".$userinfo_result['data']['user_code'];
            $tcn['url_long'] = $this->config->item("short_url").$tcn['url_now'];
            $data['room_url'] = $this->account_model->convertUrl($tcn);
            $data['file_url'] = Game_Const::ImageUrl;
            $data['image_url']= Game_Const::ImageUrl;
            $data['http_url'] = "https://connwss.fairyland.xin/";

            $data['dealer_num'] = 2;
            $data['open_id'] = '';
            $data['isAuthPhone'] = 0;
            $data['authCardCount'] = 10;
            $data['phone'] = '';
            //广播
            $data['is_announcement']=0;
            $data['announcement_content']='';
            $data['announcement_sec']='0';
            $this->load->model('message/message_model','',true);
            $result = $this->message_model->getGameMessageInfo();
            if ($result['result'] == 0) {
                $data['is_announcement'] = $result['data']['announcement_dict']['is_show'];
                $data['announcement_sec'] = $result['data']['announcement_dict']['total_sec'];
                $aContent = '';
                $arrayContent = $result['data']['announcement_dict']['content_ary'];
                foreach ($arrayContent as $value) {
                    $aContent = $aContent.$value;
                }
                $data['announcement_content'] = $aContent;
            }
            // end 广播
            $this->load->view("z12/z12.php",$data);
        }   else if(isset($_GET['i'])) {
            $direct_url = base_url("y/z12/".$_GET['i']);
            Header("Location:".$direct_url);
        }
    }
	//个人中心
	public function yh() {
		$baseurl = base_url();
		$arr = explode(':', $baseurl, 2);
		$base_host = substr($arr[1], 2, -1);
		if($base_host != $_SERVER['HTTP_HOST']){
				$direct_url = base_url('f/'.__FUNCTION__);
				Header("Location:".$direct_url);
				exit();
		}
		if(isset($_SESSION['WxOpenID']))
		{
			$open_id = $_SESSION['WxOpenID'];
			
			$request_ary['open_id'] = $open_id;
			$this->load->model('account/account_model','',true);
			$userinfo_result = $this->account_model->getUserInfo($request_ary);
			if(!isset($userinfo_result['data']['account_id']) || $userinfo_result['data']['account_id'] == "")
			{
				$direct_url = base_url("y/yh");
				Header("Location:".$direct_url);
				return;
			}
			// $data['invite_code'] = $userinfo_result['data']['invite_code'];
			// $data['level'] = $userinfo_result['data']['level'];
			// $data['group_id'] = $userinfo_result['data']['group_id'];

			$request_ary['account_id'] = $userinfo_result['data']['account_id'];
			$this->load->model('flower/room_model','',true);
			$result = $this->room_model->getRoomTicket($request_ary);

			$data['isAuthPhone'] = '0';
			$data['authCardCount'] = '0';
			$data['phone'] = $userinfo_result['data']['phone'];
            //$data['phone'] = "15986689779";
            //查询我的代理信息
            $dl_result = $this->account_model->getUserInfoDl($userinfo_result['data']['user_code']);
            $data['dl_info'] = $dl_result['data'];
            $data['dl_info_count'] = count($dl_result['data']);
            $data['totalOffline'] = 0;
            if($data['dl_info_count'] > 0)
            {
                //统计代理好友数量
                $totalOffline_info = $this->account_model->getCountDlNumbers($userinfo_result['data']['user_code']);
                $data['totalOffline'] = $totalOffline_info['data']['account'];
            }

			$session_request['dealer_num'] = 2;
			$session_request['account_id'] = $userinfo_result['data']['account_id'];
			$session_request['type'] = '';
			$this->load->model('verification_model','',true);
			$sessionResult = $this->verification_model->createRequestSession($session_request);
			$data['session'] = $sessionResult;

			$data['base_url'] = base_url();
			
			$data['socket'] = Game_Const::WebSocket_Host;
			$data['user'] = $userinfo_result['data'];
			$data['card'] = $result['data']['ticket_count'];
			$data['my_code'] = $userinfo_result['data']['my_code'];
			$data['account_id'] = $userinfo_result['data']['account_id'];

			$data['room_url'] = base_url("y/yh");
			$data['share_url'] =  base_url("y/yh");
			$data['share_icon'] = base_url("files/images/game/home.jpg");
			$data['dealer_num'] = 2;

            $data['file_url'] = $data['base_url'];
			$data['image_url'] = Game_Const::ImageUrl;
			$data['http_url'] = "https://connwss.fairyland.xin/";
            
			$this->load->model('wechat_model','',true);
			$config_ary = $this->wechat_model->getWxConfig();
			$data['config_ary']=$config_ary;

			$this->load->view("myRoomCard.php", $data);
			
		} else {
			$direct_url = base_url("y/yh");
			Header("Location:".$direct_url);
		}
	}




	/*
		获取我的游戏房票
		
		参数：
			account_id : account_id
		
		返回结果：
			
		
	*/
	public function getRoomTicket()
	{
		$open_id = $_SESSION['WxOpenID'];
		$account_id = $this->getAccountIdByOpenid($open_id);
		if($account_id <= 0)
		{
			show_404();	return;
		}
		
		$request_ary['account_id'] = $account_id;
		$this->load->model('flower/room_model','',true);
		$result = $this->room_model->getRoomTicket($request_ary);
		
		print_r(json_encode($result));
			
	}
	
	
	
	public function getActivityInfo()
	{
		$params = json_decode(file_get_contents('php://input'),true);
		
		$open_id = $_SESSION['WxOpenID'];
		$account_id = $this->getAccountIdByOpenid($open_id);
		if($account_id <= 0)
		{
			show_404();	return;
		}

		$request_ary['account_id'] = $account_id;
		$this->load->model('activity/activity_model','',true);
		$result = $this->activity_model->getActivityInfo($request_ary);
		
		print_r(json_encode($result));
			
	}
	
	
	/*
		领取活动奖励
		
		参数：
			activity_id : 活动ID
			account_id : account_id
		
		返回结果：
			
		
	*/
	public function updateActivityOpt()
	{
		$params = json_decode(file_get_contents('php://input'),true);
		if(isset($params['activity_id']))
		{
			$open_id = $_SESSION['WxOpenID'];
			$account_id = $this->getAccountIdByOpenid($open_id);
			if($account_id <= 0)
			{
				show_404();	return;
			}

			$activity_id = $params['activity_id'];
			
			$request_ary['account_id'] = $account_id;
			$request_ary['activity_id'] = $activity_id;
			$this->load->model('activity/activity_model','',true);
			$result = $this->activity_model->updateActivityOpt($request_ary);
			
			print_r(json_encode($result));
			
		}
		else
		{
			show_404();	
		}
	}

    //房间信息
    public function roomCardInfo(){

        $params = json_decode(file_get_contents('php://input'),true);

        $this->load->model('account/account_model','',true);
        $roomcard_result = $this->account_model->getTicketGoodsList();
        print_r(json_encode($roomcard_result));
    }

    //群主管理功能
    public function getManageInfo()
    {
        $params = json_decode(file_get_contents('php://input'),true);

        $open_id = $_SESSION['WxOpenID'];
        $account_id = $this->getAccountIdByOpenid($open_id);
        if($account_id <= 0)
        {
            show_404(); return;
        }

        $request_ary['account_id'] = $account_id;

        $request_ary['room_number'] = $params['room_number'];
        $request_ary['game_type'] = $params['game_type'];
        $this->load->model('activity/activity_model','',true);
        $result = $this->activity_model->getManageInfo($request_ary);

        print_r(json_encode($result));

    }
}
